Skip to content

Add multi-stream produce capability to IProducer with batch efficiency and Gateway integration  #513

@qodo-free-for-open-source-projects

Description

Description

  • Current Gateway implementation groups messages by stream then produces per-stream sequentially, creating overhead for multi-stream scenarios
  • Need efficient batch API for producing to multiple streams in parallel with single method call
  • Generic type parameter variance constraints prevent placing multi-stream overload on contravariant IProducer<in T> interface
  • Existing single-stream produce methods must remain unchanged for backward compatibility

Deliverables

  • Request Types: Create ProduceRequest and ProduceRequest<TProduceOptions> record structs as input types for multi-stream operations
  • Interface Methods: Add default interface methods to IProducer and IProducer<TProduceOptions> with parallel execution via Task.WhenAll
  • BaseProducer Implementation: Override multi-stream methods in BaseProducer<T> to support all concrete producer implementations
  • Gateway Refactor: Update GatewayHandler to batch messages by stream and use single multi-stream produce call instead of per-stream loops
  • Producer Delegation: Add multi-stream delegation methods to GatewayProducer with readiness checks
  • Test Coverage: Add unit tests validating multi-stream, empty requests, same-stream batching, and untyped request variants

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions