Class QueueMessageStream<M extends Message>

java.lang.Object
org.axonframework.messaging.core.AbstractMessageStream<M>
org.axonframework.messaging.core.QueueMessageStream<M>
Type Parameters:
M - The type of Message contained in this stream.
All Implemented Interfaces:
MessageStream<M>

public class QueueMessageStream<M extends Message> extends AbstractMessageStream<M>
A MessageStream implementation backed by a BlockingQueue.

This stream acts as a bridge between a producer and a consumer: entries are offered into an internal queue and consumed via the MessageStream API.

The stream supports both finite and dynamically produced sequences:

  • While open, the stream may temporarily have no elements available, in which case consumption methods may indicate a "not ready" state.
  • Once seal() or sealExceptionally(Throwable) is invoked, no further elements are accepted. Remaining buffered elements can still be consumed.
  • After the queue is drained, the stream completes normally or exceptionally depending on how it was sealed.

If a callback is registered via AbstractMessageStream.setCallback(Runnable), it is invoked when new elements become available. If the callback throws an exception, the stream transitions to an error state immediately and any buffered elements are discarded.

Since:
5.0.0
Author:
Allard Buijze, John Hendrikx