Skip to content

[sender] Add SendAsBatch() method to Sender for sending large message arrays with batching options #278

@karenychen

Description

@karenychen

Background

The current SendMessageBatch() in go-shuttle fails if the message array exceeds the max batch size. There is a new use case to send a large number of messages (up to 5000), which may require splitting into multiple batches.

Problem

The existing method does not support sending messages across multiple batches, and hiding this logic inside the current function could be unclear for consumers.

Proposal

  1. Add a new method: Add SendAsBatch(ctx, messages, options) to Sender, with an option like allowMultipleBatch (default: false) to control batching behavior. Reference: SDK example.
  2. Deprecate current method: Make SendMessageBatch() call the new method with allowMultipleBatch as false, and mark SendMessageBatch as deprecated.
  3. Unit tests: Ensure all existing unit tests for SendMessageBatch pass and add comprehensive unit tests for the new SendAsBatch() method. Aim for 100% unit test coverage.

Labels: enhancement, go


Additional context

  • This change should make it easier for consumers to send large numbers of messages efficiently, without having to handle the batching logic themselves.
  • Please ensure clear documentation and deprecation notices for the affected methods.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or requestgoPull requests that update go code

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions