Interface BatchingStrategy
- All Known Implementing Classes:
SimpleBatchingStrategy
public interface BatchingStrategy
Strategy for batching messages. The methods will never be called concurrently.
Experimental - APIs may change.
- Since:
- 1.4.1
- Author:
- Gary Russell
-
Method Summary
Modifier and TypeMethodDescription@Nullable MessageBatch
addToBatch
(@Nullable String exchange, @Nullable String routingKey, Message message) Add a message to the batch and optionally release the batch.default boolean
canDebatch
(MessageProperties properties) Return true if this strategy can decode a batch of messages from a message body.default void
Decode a message into fragments.@Nullable Date
Release batch(es), perhaps due to a timeout.
-
Method Details
-
addToBatch
@Nullable MessageBatch addToBatch(@Nullable String exchange, @Nullable String routingKey, Message message) Add a message to the batch and optionally release the batch.- Parameters:
exchange
- The exchange.routingKey
- The routing key.message
- The message.- Returns:
- The batched message (
MessageBatch
), or null if not ready to release.
-
nextRelease
@Nullable Date nextRelease()- Returns:
- the date the next scheduled release should run, or null if no data to release.
-
releaseBatches
Collection<MessageBatch> releaseBatches()Release batch(es), perhaps due to a timeout.- Returns:
- The batched message(s).
-
canDebatch
Return true if this strategy can decode a batch of messages from a message body. Returning true means you must overridedeBatch(Message, Consumer)
.- Parameters:
properties
- the message properties.- Returns:
- true if we can decode the message.
- Since:
- 2.2
- See Also:
-
deBatch
-