Class AeronArchive.Context

java.lang.Object
io.aeron.archive.client.AeronArchive.Context
All Implemented Interfaces:
Cloneable
Enclosing class:
AeronArchive

public static final class AeronArchive.Context extends Object implements Cloneable
Specialised configuration options for communicating with an Aeron Archive.

The context will be owned by AeronArchive after a successful AeronArchive.connect(Context) and closed via AeronArchive.close().

  • Constructor Details

    • Context

      public Context()
  • Method Details

    • clone

      public AeronArchive.Context clone()
      Perform a shallow copy of the object.
      Overrides:
      clone in class Object
      Returns:
      a shallow copy of the object.
    • conclude

      public void conclude()
      Conclude configuration by setting up defaults when specifics are not provided.
    • isConcluded

      public boolean isConcluded()
      Has the context had the conclude() method called.
      Returns:
      true of the conclude() method has been called.
    • messageTimeoutNs

      public AeronArchive.Context messageTimeoutNs(long messageTimeoutNs)
      Set the message timeout in nanoseconds to wait for sending or receiving a message.
      Parameters:
      messageTimeoutNs - to wait for sending or receiving a message.
      Returns:
      this for a fluent API.
      See Also:
    • messageTimeoutNs

      public long messageTimeoutNs()
      The message timeout in nanoseconds to wait for sending or receiving a message.
      Returns:
      the message timeout in nanoseconds to wait for sending or receiving a message.
      See Also:
    • messageRetryAttempts

      public AeronArchive.Context messageRetryAttempts(int messageRetryAttempts)
      Set the number of retry attempts to be made when offering messages to the archive.
      Parameters:
      messageRetryAttempts - the number of retry attempts.
      Returns:
      this for a fluent API.
      See Also:
    • messageRetryAttempts

      public int messageRetryAttempts()
      The number of retry attempts to be made when offering messages to the archive.
      Returns:
      the number of retry attempts.
      See Also:
    • recordingEventsChannel

      public String recordingEventsChannel()
      Get the channel URI on which the recording events publication will publish.
      Returns:
      the channel URI on which the recording events publication will publish.
    • recordingEventsChannel

      public AeronArchive.Context recordingEventsChannel(String recordingEventsChannel)
      Set the channel URI on which the recording events publication will publish.

      To support dynamic subscribers then this can be set to multicast or MDC (Multi-Destination-Cast) if multicast cannot be supported for on the available the network infrastructure.

      Parameters:
      recordingEventsChannel - channel URI on which the recording events publication will publish.
      Returns:
      this for a fluent API.
      See Also:
    • recordingEventsStreamId

      public int recordingEventsStreamId()
      Get the stream id on which the recording events publication will publish.
      Returns:
      the stream id on which the recording events publication will publish.
    • recordingEventsStreamId

      public AeronArchive.Context recordingEventsStreamId(int recordingEventsStreamId)
      Set the stream id on which the recording events publication will publish.
      Parameters:
      recordingEventsStreamId - stream id on which the recording events publication will publish.
      Returns:
      this for a fluent API.
    • controlRequestChannel

      public AeronArchive.Context controlRequestChannel(String channel)
      Set the channel parameter for the control request channel.
      Parameters:
      channel - parameter for the control request channel.
      Returns:
      this for a fluent API.
      See Also:
    • controlRequestChannel

      public String controlRequestChannel()
      Get the channel parameter for the control request channel.
      Returns:
      the channel parameter for the control request channel.
      See Also:
    • controlRequestStreamId

      public AeronArchive.Context controlRequestStreamId(int streamId)
      Set the stream id for the control request channel.
      Parameters:
      streamId - for the control request channel.
      Returns:
      this for a fluent API
      See Also:
    • controlRequestStreamId

      public int controlRequestStreamId()
      Get the stream id for the control request channel.
      Returns:
      the stream id for the control request channel.
      See Also:
    • controlResponseChannel

      public AeronArchive.Context controlResponseChannel(String channel)
      Set the channel parameter for the control response channel.
      Parameters:
      channel - parameter for the control response channel.
      Returns:
      this for a fluent API.
      See Also:
    • controlResponseChannel

      public String controlResponseChannel()
      Get the channel parameter for the control response channel.
      Returns:
      the channel parameter for the control response channel.
      See Also:
    • controlResponseStreamId

      public AeronArchive.Context controlResponseStreamId(int streamId)
      Set the stream id for the control response channel.
      Parameters:
      streamId - for the control response channel.
      Returns:
      this for a fluent API
      See Also:
    • controlResponseStreamId

      public int controlResponseStreamId()
      Get the stream id for the control response channel.
      Returns:
      the stream id for the control response channel.
      See Also:
    • controlTermBufferSparse

      public AeronArchive.Context controlTermBufferSparse(boolean controlTermBufferSparse)
      Should the control streams use sparse file term buffers.
      Parameters:
      controlTermBufferSparse - for the control stream.
      Returns:
      this for a fluent API.
      See Also:
    • controlTermBufferSparse

      public boolean controlTermBufferSparse()
      Should the control streams use sparse file term buffers.
      Returns:
      true if the control stream should use sparse file term buffers.
      See Also:
    • controlTermBufferLength

      public AeronArchive.Context controlTermBufferLength(int controlTermBufferLength)
      Set the term buffer length for the control streams.
      Parameters:
      controlTermBufferLength - for the control streams.
      Returns:
      this for a fluent API.
      See Also:
    • controlTermBufferLength

      public int controlTermBufferLength()
      Get the term buffer length for the control streams.
      Returns:
      the term buffer length for the control streams.
      See Also:
    • controlMtuLength

      public AeronArchive.Context controlMtuLength(int controlMtuLength)
      Set the MTU length for the control streams.
      Parameters:
      controlMtuLength - for the control streams.
      Returns:
      this for a fluent API.
      See Also:
    • controlMtuLength

      public int controlMtuLength()
      Get the MTU length for the control streams.
      Returns:
      the MTU length for the control streams.
      See Also:
    • idleStrategy

      public AeronArchive.Context idleStrategy(IdleStrategy idleStrategy)
      Set the IdleStrategy used when waiting for responses.
      Parameters:
      idleStrategy - used when waiting for responses.
      Returns:
      this for a fluent API.
    • idleStrategy

      public IdleStrategy idleStrategy()
      Get the IdleStrategy used when waiting for responses.
      Returns:
      the IdleStrategy used when waiting for responses.
    • aeronDirectoryName

      public AeronArchive.Context aeronDirectoryName(String aeronDirectoryName)
      Set the top level Aeron directory used for communication between the Aeron client and Media Driver.
      Parameters:
      aeronDirectoryName - the top level Aeron directory.
      Returns:
      this for a fluent API.
    • aeronDirectoryName

      public String aeronDirectoryName()
      Get the top level Aeron directory used for communication between the Aeron client and Media Driver.
      Returns:
      The top level Aeron directory.
    • clientName

      public AeronArchive.Context clientName(String clientName)
      Sets the name used to identify this client among other clients connected to the Archive.
      Parameters:
      clientName - to use.
      Returns:
      this for a fluent API.
      Since:
      1.49.0
      See Also:
    • clientName

      public String clientName()
      Returns the name of this client.
      Returns:
      name of this client or empty String if not configured.
      Since:
      1.49.0
      See Also:
    • aeron

      public AeronArchive.Context aeron(Aeron aeron)
      Aeron client for communicating with the local Media Driver.

      This client will be closed when the AeronArchive.close() or close() methods are called if ownsAeronClient() is true.

      Parameters:
      aeron - client for communicating with the local Media Driver.
      Returns:
      this for a fluent API.
      See Also:
    • aeron

      public Aeron aeron()
      Aeron client for communicating with the local Media Driver.

      If not provided then a default will be established during conclude() by calling Aeron.connect().

      Returns:
      client for communicating with the local Media Driver.
    • ownsAeronClient

      public AeronArchive.Context ownsAeronClient(boolean ownsAeronClient)
      Does this context own the aeron() client and thus takes responsibility for closing it?
      Parameters:
      ownsAeronClient - does this context own the aeron() client?
      Returns:
      this for a fluent API.
    • ownsAeronClient

      public boolean ownsAeronClient()
      Does this context own the aeron() client and thus takes responsibility for closing it?
      Returns:
      does this context own the aeron() client and thus takes responsibility for closing it?
    • lock

      public AeronArchive.Context lock(Lock lock)
      The Lock that is used to provide mutual exclusion in the AeronArchive client.

      If the AeronArchive is used from only a single thread then the lock can be set to NoOpLock to elide the lock overhead.

      Parameters:
      lock - that is used to provide mutual exclusion in the AeronArchive client.
      Returns:
      this for a fluent API.
    • lock

      public Lock lock()
      Get the Lock that is used to provide mutual exclusion in the AeronArchive client.
      Returns:
      the Lock that is used to provide mutual exclusion in the AeronArchive client.
    • errorHandler

      public AeronArchive.Context errorHandler(ErrorHandler errorHandler)
      Handle errors returned asynchronously from the archive for a control session.
      Parameters:
      errorHandler - method to handle objects of type Throwable.
      Returns:
      this for a fluent API.
    • errorHandler

      public ErrorHandler errorHandler()
      Get the error handler that will be called for asynchronous errors.
      Returns:
      the error handler that will be called for asynchronous errors.
    • credentialsSupplier

      public AeronArchive.Context credentialsSupplier(CredentialsSupplier credentialsSupplier)
      Set the CredentialsSupplier to be used for authentication with the archive.
      Parameters:
      credentialsSupplier - to be used for authentication with the archive.
      Returns:
      this for fluent API.
    • credentialsSupplier

      public CredentialsSupplier credentialsSupplier()
      Get the CredentialsSupplier to be used for authentication with the archive.
      Returns:
      the CredentialsSupplier to be used for authentication with the archive.
    • recordingSignalConsumer

      public AeronArchive.Context recordingSignalConsumer(RecordingSignalConsumer recordingSignalConsumer)
      Set the RecordingSignalConsumer to will be called when polling for responses from an Archive.
      Parameters:
      recordingSignalConsumer - to called with recording signal events.
      Returns:
      this for a fluent API.
    • recordingSignalConsumer

      public RecordingSignalConsumer recordingSignalConsumer()
      Set the RecordingSignalConsumer to will be called when polling for responses from an Archive.
      Returns:
      a recording signal consumer.
    • agentInvoker

      public AeronArchive.Context agentInvoker(AgentInvoker agentInvoker)
      Set the AgentInvoker to be invoked in addition to any invoker used by the aeron() instance.

      Useful for when running on a low thread count scenario.

      Note: it is the responsibility of the user to invoke agentInvoker and the aeron.conductorAgentInvoker() periodically outside of this class. AeronArchive will invoke those when doing blocking operations (e.g. AeronArchive.getMaxRecordedPosition(long))

      Parameters:
      agentInvoker - to be invoked while awaiting a response in the client.
      Returns:
      this for a fluent API.
    • agentInvoker

      public AgentInvoker agentInvoker()
      Get the AgentInvoker to be invoked in addition to any invoker used by the aeron() instance.
      Returns:
      the AgentInvoker that is used.
    • close

      public void close()
      Close the context and free applicable resources.

      If ownsAeronClient() is true then the aeron() client will be closed.

    • toString

      public String toString()
      Overrides:
      toString in class Object