Class PersistentStreamMessageSource
java.lang.Object
org.axonframework.axonserver.connector.event.axon.PersistentStreamMessageSource
- All Implemented Interfaces:
SubscribableMessageSource<EventMessage<?>>
public class PersistentStreamMessageSource
extends Object
implements SubscribableMessageSource<EventMessage<?>>
A
SubscribableMessageSource that receives event from a persistent stream from Axon Server. The persistent
stream is identified by a unique name, which serves as an identifier for the PersistentStream connection with
Axon Server. Using the same name for different instances will overwrite the existing connection.- Since:
- 4.10.0
- Author:
- Marc Gathier
-
Constructor Summary
ConstructorsConstructorDescriptionPersistentStreamMessageSource(String name, Configuration configuration, io.axoniq.axonserver.connector.event.PersistentStreamProperties persistentStreamProperties, ScheduledExecutorService scheduler, int batchSize) Instantiates aPersistentStreamMessageSource.PersistentStreamMessageSource(String name, Configuration configuration, io.axoniq.axonserver.connector.event.PersistentStreamProperties persistentStreamProperties, ScheduledExecutorService scheduler, int batchSize, String context) Instantiates aPersistentStreamMessageSource. -
Method Summary
Modifier and TypeMethodDescriptionsubscribe(Consumer<List<? extends EventMessage<?>>> consumer) Subscribe the givenmessageProcessorto this message source.
-
Constructor Details
-
PersistentStreamMessageSource
public PersistentStreamMessageSource(String name, Configuration configuration, io.axoniq.axonserver.connector.event.PersistentStreamProperties persistentStreamProperties, ScheduledExecutorService scheduler, int batchSize) Instantiates aPersistentStreamMessageSource.- Parameters:
name- The name of the persistent stream. It's a unique identifier of thePersistentStreamconnection with Axon Sever. Usage of the same name will overwrite the existing connection.configuration- Global configuration of Axon components.persistentStreamProperties- Properties for the persistent stream.scheduler- Scheduler thread pool to schedule tasks.batchSize- The batch size for collecting events.
-
PersistentStreamMessageSource
public PersistentStreamMessageSource(String name, Configuration configuration, io.axoniq.axonserver.connector.event.PersistentStreamProperties persistentStreamProperties, ScheduledExecutorService scheduler, int batchSize, String context) Instantiates aPersistentStreamMessageSource.- Parameters:
name- The name of the persistent stream. It's a unique identifier of thePersistentStreamconnection with Axon Sever. Usage of the same name will overwrite the existing connection.configuration- Global configuration of Axon components.persistentStreamProperties- Properties for the persistent stream.scheduler- Scheduler thread pool to schedule tasks.batchSize- The batch size for collecting events.context- The context in which this persistent stream exists (or needs to be created).
-
-
Method Details
-
subscribe
Description copied from interface:SubscribableMessageSourceSubscribe the givenmessageProcessorto this message source. When subscribed, it will receive all messages published to this source.If the given
messageProcessoris already subscribed, nothing happens.- Specified by:
subscribein interfaceSubscribableMessageSource<EventMessage<?>>- Parameters:
consumer- The message processor to subscribe- Returns:
- a handle to unsubscribe the
messageProcessor. When unsubscribed it will no longer receive messages.
-