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 TypeMethodDescriptionaddToBatch(String exchange, String routingKey, Message message) Add a message to the batch and optionally release the batch.default booleancanDebatch(MessageProperties properties) Return true if this strategy can decode a batch of messages from a message body.default voidDecode a message into fragments.Release batch(es), perhaps due to a timeout.
-
Method Details
-
addToBatch
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
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
-