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 Details

    • PersistentStreamMessageSource

      public PersistentStreamMessageSource(String name, Configuration configuration, io.axoniq.axonserver.connector.event.PersistentStreamProperties persistentStreamProperties, ScheduledExecutorService scheduler, int batchSize)
      Instantiates a PersistentStreamMessageSource.
      Parameters:
      name - The name of the persistent stream. It's a unique identifier of the PersistentStream connection 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 a PersistentStreamMessageSource.
      Parameters:
      name - The name of the persistent stream. It's a unique identifier of the PersistentStream connection 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

      public Registration subscribe(@Nonnull Consumer<List<? extends EventMessage<?>>> consumer)
      Description copied from interface: SubscribableMessageSource
      Subscribe the given messageProcessor to this message source. When subscribed, it will receive all messages published to this source.

      If the given messageProcessor is already subscribed, nothing happens.

      Specified by:
      subscribe in interface SubscribableMessageSource<EventMessage<?>>
      Parameters:
      consumer - The message processor to subscribe
      Returns:
      a handle to unsubscribe the messageProcessor. When unsubscribed it will no longer receive messages.