Package io.aeron

Class CommonContext

java.lang.Object
io.aeron.CommonContext
All Implemented Interfaces:
Cloneable
Direct Known Subclasses:
Aeron.Context, MediaDriver.Context

public class CommonContext extends Object implements Cloneable
This class provides the Media Driver and client with common configuration for the Aeron directory.

This class should have conclude() called before the methods are used or at least concludeAeronDirectory() to avoid NPEs.

Properties:

  • aeron.dir: Use value as directory name for Aeron buffers and status.
  • Field Details

    • DRIVER_TIMEOUT_PROP_NAME

      public static final String DRIVER_TIMEOUT_PROP_NAME
      Property name for driver timeout after which the driver is considered inactive.
      See Also:
    • DEBUG_TIMEOUT_PROP_NAME

      public static final String DEBUG_TIMEOUT_PROP_NAME
      Property name for the timeout to use in debug mode. By default, this is not set and the configured timeouts will be used. Setting this value adjusts timeouts to make debugging easier.
      See Also:
    • DEFAULT_DRIVER_TIMEOUT_MS

      public static final long DEFAULT_DRIVER_TIMEOUT_MS
      Default timeout in which the driver is expected to respond or heartbeat.
      See Also:
    • DRIVER_TIMEOUT_MS

      public static final long DRIVER_TIMEOUT_MS
      Timeout in which the driver is expected to respond or heartbeat.
    • NULL_SESSION_ID

      public static final int NULL_SESSION_ID
      Value to represent a sessionId that is not to be used.
      See Also:
    • AERON_DIR_PROP_NAME

      public static final String AERON_DIR_PROP_NAME
      The top level Aeron directory used for communication between a Media Driver and client.
      See Also:
    • AERON_DIR_PROP_DEFAULT

      public static final String AERON_DIR_PROP_DEFAULT
      The value of the top level Aeron directory unless overridden by aeronDirectoryName(String).
    • ENABLE_EXPERIMENTAL_FEATURES_PROP_NAME

      public static final String ENABLE_EXPERIMENTAL_FEATURES_PROP_NAME
      Should new/experimental features be enabled.
      Since:
      1.44.0
      See Also:
    • FALLBACK_LOGGER_PROP_NAME

      public static final String FALLBACK_LOGGER_PROP_NAME
      Property name for a fallback PrintStream based logger when it is not possible to use the error logging callback. Supported values are stdout, stderr, no_op (stderr is the default).
      See Also:
    • IPC_MEDIA

      public static final String IPC_MEDIA
      Media type used for IPC shared memory from Publication to Subscription channels.
      See Also:
    • UDP_MEDIA

      public static final String UDP_MEDIA
      Media type used for UDP sockets from Publication to Subscription channels.
      See Also:
    • IPC_CHANNEL

      public static final String IPC_CHANNEL
      URI base used for IPC channels for Publications and Subscriptions.
      See Also:
    • UDP_CHANNEL

      public static final String UDP_CHANNEL
      URI base used for UDP channels for Publications and Subscriptions.
      See Also:
    • SPY_PREFIX

      public static final String SPY_PREFIX
      URI used for Spy Subscriptions whereby an outgoing unicast or multicast publication can be spied on by IPC without receiving it again via the network.
      See Also:
    • ENDPOINT_PARAM_NAME

      public static final String ENDPOINT_PARAM_NAME
      The address and port used for a UDP channel. For the publisher it is the socket to send to, for the subscriber it is the socket to receive from.
      See Also:
    • INTERFACE_PARAM_NAME

      public static final String INTERFACE_PARAM_NAME
      The network interface via which the socket will be routed.
      See Also:
    • INITIAL_TERM_ID_PARAM_NAME

      public static final String INITIAL_TERM_ID_PARAM_NAME
      Initial term id to be used when creating an ExclusivePublication.
      See Also:
    • TERM_ID_PARAM_NAME

      public static final String TERM_ID_PARAM_NAME
      Current term id to be used when creating an ExclusivePublication.
      See Also:
    • TERM_OFFSET_PARAM_NAME

      public static final String TERM_OFFSET_PARAM_NAME
      Current term offset to be used when creating an ExclusivePublication.
      See Also:
    • TERM_LENGTH_PARAM_NAME

      public static final String TERM_LENGTH_PARAM_NAME
      The param name to be used for the term length as a channel URI param.
      See Also:
    • MTU_LENGTH_PARAM_NAME

      public static final String MTU_LENGTH_PARAM_NAME
      MTU length parameter name for using as a channel URI param. If this is greater than the network MTU for UDP then the packet will be fragmented and can amplify the impact of loss.
      See Also:
    • TTL_PARAM_NAME

      public static final String TTL_PARAM_NAME
      Time To Live param for a multicast datagram.
      See Also:
    • MDC_CONTROL_PARAM_NAME

      public static final String MDC_CONTROL_PARAM_NAME
      The param for the control channel IP address and port for multi-destination-cast semantics.
      See Also:
    • MDC_CONTROL_MODE_PARAM_NAME

      public static final String MDC_CONTROL_MODE_PARAM_NAME
      Key for the mode of control that such be used for multi-destination-cast semantics.
      See Also:
    • MDC_CONTROL_MODE_MANUAL

      public static final String MDC_CONTROL_MODE_MANUAL
      Valid value for MDC_CONTROL_MODE_PARAM_NAME when manual control is desired.
      See Also:
    • MDC_CONTROL_MODE_DYNAMIC

      public static final String MDC_CONTROL_MODE_DYNAMIC
      Valid value for MDC_CONTROL_MODE_PARAM_NAME when dynamic control is desired. Default value.
      See Also:
    • CONTROL_MODE_RESPONSE

      public static final String CONTROL_MODE_RESPONSE
      Valid value for MDC_CONTROL_MODE_PARAM_NAME when response control is desired.
      See Also:
    • SESSION_ID_PARAM_NAME

      public static final String SESSION_ID_PARAM_NAME
      Key for the session id for a publication or restricted subscription.
      See Also:
    • LINGER_PARAM_NAME

      public static final String LINGER_PARAM_NAME
      Key for timeout a publication to linger after draining in nanoseconds.
      See Also:
    • RELIABLE_STREAM_PARAM_NAME

      public static final String RELIABLE_STREAM_PARAM_NAME
      Parameter name for channel URI param to indicate if a subscribed stream must be reliable or not. Value is boolean with true to recover loss and false to gap fill.
      See Also:
    • TAGS_PARAM_NAME

      public static final String TAGS_PARAM_NAME
      Key for the tags for a channel.
      See Also:
    • TAG_PREFIX

      public static final String TAG_PREFIX
      Qualifier for a value which is a tag for reference. This prefix is use in the param value.
      See Also:
    • SPARSE_PARAM_NAME

      public static final String SPARSE_PARAM_NAME
      Parameter name for channel URI param to indicate if term buffers should be sparse. Value is boolean.
      See Also:
    • ALIAS_PARAM_NAME

      public static final String ALIAS_PARAM_NAME
      Parameter name for channel URI param to indicate an alias for the given URI. Value not interpreted by Aeron.

      This is a reserved application level param used to identify a particular channel for application purposes.

      See Also:
    • EOS_PARAM_NAME

      public static final String EOS_PARAM_NAME
      Parameter name for channel URI param to indicate if End of Stream (EOS) should be sent or not. Value is boolean.
      See Also:
    • TETHER_PARAM_NAME

      public static final String TETHER_PARAM_NAME
      Parameter name for channel URI param to indicate if a subscription should tether for local flow control. Value is boolean. A tether only applies when there is more than one matching active subscription. If tether is true then that subscription is included in flow control. If only one subscription then it tethers pace.
      See Also:
    • GROUP_PARAM_NAME

      public static final String GROUP_PARAM_NAME
      Parameter name for channel URI param to indicate if a Subscription represents a group member or individual from the perspective of message reception. This can inform loss handling and similar semantics.

      When configuring a subscription for an MDC publication then should be added as this is effective multicast.

      See Also:
    • REJOIN_PARAM_NAME

      public static final String REJOIN_PARAM_NAME
      Parameter name for Subscription URI param to indicate if Images that go unavailable should be allowed to rejoin after a short cooldown or not.
      See Also:
    • CONGESTION_CONTROL_PARAM_NAME

      public static final String CONGESTION_CONTROL_PARAM_NAME
      Parameter name for Subscription URI param to indicate the congestion control algorithm to be used. Options include static and cubic.
      See Also:
    • FLOW_CONTROL_PARAM_NAME

      public static final String FLOW_CONTROL_PARAM_NAME
      Parameter name for Publication URI param to indicate the flow control strategy to be used. Options include min, max, and pref.
      See Also:
    • GROUP_TAG_PARAM_NAME

      public static final String GROUP_TAG_PARAM_NAME
      Parameter name for Subscription URI param to indicate the receiver tag to be sent in SMs.
      See Also:
    • SPIES_SIMULATE_CONNECTION_PARAM_NAME

      public static final String SPIES_SIMULATE_CONNECTION_PARAM_NAME
      Parameter name for Publication URI param to indicate whether spy subscriptions should simulate a connection.
      See Also:
    • SOCKET_SNDBUF_PARAM_NAME

      public static final String SOCKET_SNDBUF_PARAM_NAME
      Parameter name for the underlying OS socket send buffer length.
      See Also:
    • SOCKET_RCVBUF_PARAM_NAME

      public static final String SOCKET_RCVBUF_PARAM_NAME
      Parameter name for the underlying OS socket receive buffer length.
      See Also:
    • RECEIVER_WINDOW_LENGTH_PARAM_NAME

      public static final String RECEIVER_WINDOW_LENGTH_PARAM_NAME
      Parameter name for the congestion control's initial receiver window length.
      See Also:
    • MEDIA_RCV_TIMESTAMP_OFFSET_PARAM_NAME

      public static final String MEDIA_RCV_TIMESTAMP_OFFSET_PARAM_NAME
      Parameter name of the offset for the media receive timestamp to be inserted into the incoming message on a subscription. The special value of 'reserved' can be used to insert into the reserved value field. Media receive timestamp is taken as the earliest possible point after the packet is received from the network. This is only supported in the C media driver, the Java Media Driver will generate an error if used.
      See Also:
    • CHANNEL_RECEIVE_TIMESTAMP_OFFSET_PARAM_NAME

      public static final String CHANNEL_RECEIVE_TIMESTAMP_OFFSET_PARAM_NAME
      Parameter name of the offset for the channel receive timestamp to be inserted into the incoming message on a subscription. The special value of 'reserved' can be used to insert into the reserved value field. Channel receive timestamp is taken as soon a possible after the packet is received by Aeron receiver from the transport bindings.
      See Also:
    • CHANNEL_SEND_TIMESTAMP_OFFSET_PARAM_NAME

      public static final String CHANNEL_SEND_TIMESTAMP_OFFSET_PARAM_NAME
      Parameter name of the offset for the channel send timestamp to be inserted into the outgoing message on a publication. The special value of 'reserved' can be used to insert into the reserved value field. Channel send timestamp is taken shortly before passing the message over to the configured transport bindings.
      See Also:
    • RESERVED_OFFSET

      public static final String RESERVED_OFFSET
      Placeholder value to use in URIs to specify that a timestamp should be stored in the reserved value field.
      See Also:
    • RESPONSE_ENDPOINT_PARAM_NAME

      public static final String RESPONSE_ENDPOINT_PARAM_NAME
      Parameter name for the field that will be used to specify the response endpoint on a subscription and publication used in a response "server".
      Since:
      1.44.0
      See Also:
    • RESPONSE_CORRELATION_ID_PARAM_NAME

      public static final String RESPONSE_CORRELATION_ID_PARAM_NAME
      Parameter name for the field that will be used to specify the correlation id used on a publication to connect it to a subscription's image in order to set up a response stream.
      Since:
      1.44.0
      See Also:
    • PROTOTYPE_CORRELATION_ID

      public static final String PROTOTYPE_CORRELATION_ID
      Placeholder value to use in response channels where the publication is to be pre-created to reserve and hold onto the local port.
      See Also:
    • NAK_DELAY_PARAM_NAME

      public static final String NAK_DELAY_PARAM_NAME
      Parameter name to set explicit NAK delay (e.g. nak-delay=200ms).
      Since:
      1.44.0
      See Also:
    • UNTETHERED_WINDOW_LIMIT_TIMEOUT_PARAM_NAME

      public static final String UNTETHERED_WINDOW_LIMIT_TIMEOUT_PARAM_NAME
      Parameter name to set explicit untethered window limit timeout, e.g. untethered-window-limit-timeout=10s.
      Since:
      1.45.0
      See Also:
    • UNTETHERED_LINGER_TIMEOUT_PARAM_NAME

      public static final String UNTETHERED_LINGER_TIMEOUT_PARAM_NAME
      Parameter name to set explicit untethered linger timeout, e.g. untethered-linger-timeout=10s.
      Since:
      1.48.0
      See Also:
    • UNTETHERED_RESTING_TIMEOUT_PARAM_NAME

      public static final String UNTETHERED_RESTING_TIMEOUT_PARAM_NAME
      Parameter name to set explicit untethered resting timeout, e.g. untethered-resting-timeout=10s.
      Since:
      1.45.0
      See Also:
    • MAX_RESEND_PARAM_NAME

      public static final String MAX_RESEND_PARAM_NAME
      Parameter name to set the max number of outstanding active retransmits for a publication.
      Since:
      1.45.0
      See Also:
    • STREAM_ID_PARAM_NAME

      public static final String STREAM_ID_PARAM_NAME
      Parameter name to set the stream id for the channel.
      Since:
      1.47.0
      See Also:
    • PUBLICATION_WINDOW_LENGTH_PARAM_NAME

      public static final String PUBLICATION_WINDOW_LENGTH_PARAM_NAME
      Parameter name for the publication window length, i.e. how far ahead can publication accept offers.
      Since:
      1.47.0
      See Also:
    • SECURE_RANDOM_ALGORITHM_PROP_NAME

      public static final String SECURE_RANDOM_ALGORITHM_PROP_NAME
      Property name to use to set the secure random algorithm to be used by the Aeron component.
      See Also:
    • SECURE_RANDOM_ALGORITHM_DEFAULT

      public static final String SECURE_RANDOM_ALGORITHM_DEFAULT
      The default secure random algorithm to be used.
  • Constructor Details

    • CommonContext

      public CommonContext()
  • Method Details

    • shouldPrintConfigurationOnStart

      public static boolean shouldPrintConfigurationOnStart()
      Should a component's configuration be printed on start.
      Returns:
      true if the configuration should be printed on start.
      See Also:
    • getSecureRandomAlgorithm

      public static String getSecureRandomAlgorithm()
      Get the configured value for the secure random algorithm, falling back to the default if not supplied.
      Returns:
      the secure random algorithm
      See Also:
    • fallbackLogger

      public static PrintStream fallbackLogger()
      Get the current fallback logger based on the supplied property.
      Returns:
      the configured PrintStream.
    • clone

      public CommonContext clone()
      Perform a shallow copy of the object.
      Overrides:
      clone in class Object
      Returns:
      a shallow copy of the object.
    • getAeronDirectoryName

      public static String getAeronDirectoryName()
      Get the default directory name to be used if aeronDirectoryName(String) is not set. This will take the AERON_DIR_PROP_NAME if set and if not then AERON_DIR_PROP_DEFAULT.
      Returns:
      the default directory name to be used if aeronDirectoryName(String) is not set.
    • generateRandomDirName

      public static String generateRandomDirName()
      Convert the default Aeron directory name to be a random name for use with embedded drivers.
      Returns:
      random directory name with default directory name as base
    • conclude

      public CommonContext conclude()
      This completes initialization of the CommonContext object. It is automatically called by subclasses.
      Returns:
      this Object for method chaining.
    • isConcluded

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

      public CommonContext concludeAeronDirectory()
      Conclude the aeronDirectory() so it does not need to keep being recreated.
      Returns:
      this for a fluent API.
    • aeronDirectoryName

      public String aeronDirectoryName()
      Get the top level Aeron directory used for communication between the client and Media Driver, and the location of the data buffers.
      Returns:
      The top level Aeron directory.
    • aeronDirectory

      public File aeronDirectory()
      Get the directory in which the aeron config files are stored.

      This is valid after a call to conclude() or concludeAeronDirectory().

      Returns:
      the directory in which the aeron config files are stored.
      See Also:
    • aeronDirectoryName

      public CommonContext aeronDirectoryName(String dirName)
      Set the top level Aeron directory used for communication between the client and Media Driver, and the location of the data buffers.
      Parameters:
      dirName - New top level Aeron directory.
      Returns:
      this for a fluent API.
    • newDefaultCncFile

      public static File newDefaultCncFile()
      Create a new command and control file in the administration directory.
      Returns:
      The newly created File.
    • newCncFile

      public static File newCncFile(String aeronDirectoryName)
      Create a new command and control file in the administration directory.
      Parameters:
      aeronDirectoryName - name of the aeronDirectory that containing the cnc file.
      Returns:
      The newly created File.
    • countersMetaDataBuffer

      public UnsafeBuffer countersMetaDataBuffer()
      Get the buffer containing the counter metadata. These counters are R/W for the driver, read only for all other users.
      Returns:
      The buffer storing the counter metadata.
    • countersMetaDataBuffer

      public CommonContext countersMetaDataBuffer(UnsafeBuffer countersMetaDataBuffer)
      Set the buffer containing the counter metadata. Testing/internal purposes only.
      Parameters:
      countersMetaDataBuffer - The new counter metadata buffer.
      Returns:
      this for a fluent API.
    • countersValuesBuffer

      public UnsafeBuffer countersValuesBuffer()
      Get the buffer containing the counters. These counters are R/W for the driver, read only for all other users.
      Returns:
      The buffer storing the counters.
    • countersValuesBuffer

      public CommonContext countersValuesBuffer(UnsafeBuffer countersValuesBuffer)
      Set the buffer containing the counters. Testing/internal purposes only.
      Parameters:
      countersValuesBuffer - The new counters buffer.
      Returns:
      this for a fluent API.
    • cncFile

      public File cncFile()
      Get the command and control file.
      Returns:
      The command and control file.
    • driverTimeoutMs

      public CommonContext driverTimeoutMs(long driverTimeoutMs)
      Set the driver timeout in milliseconds.
      Parameters:
      driverTimeoutMs - to indicate liveness of driver
      Returns:
      this for a fluent API.
    • driverTimeoutMs

      public long driverTimeoutMs()
      Get the driver timeout in milliseconds.
      Returns:
      driver timeout in milliseconds.
    • enableExperimentalFeatures

      public boolean enableExperimentalFeatures()
      Should experimental features for the driver be enabled.
      Returns:
      true if enabled, false otherwise.
      Since:
      1.44.0
      See Also:
    • enableExperimentalFeatures

      public CommonContext enableExperimentalFeatures(boolean enableExperimentalFeatures)
      Should experimental features for the driver be enabled.
      Parameters:
      enableExperimentalFeatures - indicate whether experimental features for the driver should be enabled.
      Returns:
      this for a fluent API
      Since:
      1.44.0
      See Also:
    • checkDebugTimeout

      public static long checkDebugTimeout(long timeout, TimeUnit timeUnit)
      Override the supplied timeout with the debug value if it has been set, and we are in debug mode.
      Parameters:
      timeout - The timeout value currently in use.
      timeUnit - The units of the timeout value. Debug timeout is specified in ns, so will be converted to this unit.
      Returns:
      The debug timeout if specified, and we are being debugged or the supplied value if not. Will be in timeUnit units.
    • checkDebugTimeout

      public static long checkDebugTimeout(long timeout, TimeUnit timeUnit, double factor)
      Override the supplied timeout with the debug value if it has been set, and we are in debug mode.
      Parameters:
      timeout - The timeout value currently in use.
      timeUnit - The units of the timeout value. Debug timeout is specified in ns, so will be converted to this unit.
      factor - to multiply the debug timeout by. Required when some timeouts need to be larger than others in order to pass validation. E.g. clientLiveness and publicationUnblock.
      Returns:
      The debug timeout if specified, and we are being debugged or the supplied value if not. Will be in timeUnit units.
    • deleteAeronDirectory

      public void deleteAeronDirectory()
      Delete the current Aeron directory, throwing errors if not possible.
    • mapExistingCncFile

      public MappedByteBuffer mapExistingCncFile(Consumer<String> logger)
      Map the CnC file if it exists.
      Parameters:
      logger - for feedback
      Returns:
      a new mapping for the file if it exists otherwise null;
    • isDriverActive

      public static boolean isDriverActive(File directory, long driverTimeoutMs, Consumer<String> logger)
      Is a media driver active in the given directory?
      Parameters:
      directory - to check.
      driverTimeoutMs - for the driver liveness check.
      logger - for feedback as liveness checked.
      Returns:
      true if a driver is active or false if not.
    • isDriverActive

      public boolean isDriverActive(long driverTimeoutMs, Consumer<String> logger)
      Is a media driver active in the current Aeron directory?
      Parameters:
      driverTimeoutMs - for the driver liveness check.
      logger - for feedback as liveness checked.
      Returns:
      true if a driver is active or false if not.
    • isDriverActive

      public static boolean isDriverActive(long driverTimeoutMs, Consumer<String> logger, ByteBuffer cncByteBuffer)
      Is a media driver active in the current mapped CnC buffer? If the driver is starting then it will wait for up to the driverTimeoutMs by checking for the cncVersion being set.
      Parameters:
      driverTimeoutMs - for the driver liveness check.
      logger - for feedback as liveness checked.
      cncByteBuffer - for the existing CnC file.
      Returns:
      true if a driver is active or false if not.
    • requestDriverTermination

      public static boolean requestDriverTermination(File directory, DirectBuffer tokenBuffer, int tokenOffset, int tokenLength)
      Request a driver to run its termination hook.
      Parameters:
      directory - for the driver.
      tokenBuffer - containing the optional token for the request.
      tokenOffset - within the tokenBuffer at which the token begins.
      tokenLength - of the token in the tokenBuffer.
      Returns:
      true if request was sent or false if request could not be sent.
    • saveErrorLog

      public int saveErrorLog(PrintStream out)
      Read the error log to a given PrintStream.
      Parameters:
      out - to write the error log contents to.
      Returns:
      the number of observations from the error log.
    • saveErrorLog

      public int saveErrorLog(PrintStream out, ByteBuffer cncByteBuffer)
      Read the error log to a given PrintStream.
      Parameters:
      out - to write the error log contents to.
      cncByteBuffer - containing the error log.
      Returns:
      the number of observations from the error log.
    • close

      public void close()
      Release resources used by the CommonContext.
    • printErrorLog

      public static int printErrorLog(AtomicBuffer errorBuffer, PrintStream out)
      Print the contents of an error log to a PrintStream in human-readable format.
      Parameters:
      errorBuffer - to read errors from.
      out - print the errors to.
      Returns:
      number of distinct errors observed.
    • saveExistingErrors

      public static void saveExistingErrors(File markFile, AtomicBuffer errorBuffer, PrintStream logger, String errorFilePrefix)
      Save the existing errors from a MarkFile to a file in the same directory as the original MarkFile and optionally print location of such file to the supplied PrintStream.
      Parameters:
      markFile - which contains the error buffer.
      errorBuffer - which wraps the error log.
      logger - to which the existing errors will be printed.
      errorFilePrefix - to add to the generated error file.
    • errorLogBuffer

      public static AtomicBuffer errorLogBuffer(ByteBuffer cncByteBuffer)
      Get an AtomicBuffer which wraps the error log in the CnC file.
      Parameters:
      cncByteBuffer - which contains the error log.
      Returns:
      an AtomicBuffer which wraps the error log in the CnC file.
    • setupErrorHandler

      public static ErrorHandler setupErrorHandler(ErrorHandler userErrorHandler, DistinctErrorLog errorLog)
      Wrap a user ErrorHandler so that error will continue to write to the errorLog.
      Parameters:
      userErrorHandler - the user specified ErrorHandler, can be null.
      errorLog - the configured errorLog, either the default or user supplied.
      Returns:
      an error handler that will delegate to both the userErrorHandler and the errorLog.
    • driverFilePageSize

      public static int driverFilePageSize(File aeronDirectory, EpochClock clock, long timeoutMs)
      Connect to the media driver and extract file page size from the C'n'C file.
      Parameters:
      aeronDirectory - where driver is running.
      clock - to use.
      timeoutMs - for awaiting connection.
      Returns:
      file page size from running media driver or LogBufferDescriptor.PAGE_MIN_SIZE if driver is old.
      Since:
      1.48.0
    • nextCorrelationId

      public static long nextCorrelationId(File aeronDirectory, EpochClock clock, long timeoutMs)
      Connect to the media driver and get the nextCorrelationId.
      Parameters:
      aeronDirectory - where driver is running.
      clock - to use.
      timeoutMs - for awaiting connection.
      Returns:
      next correlation id.
      Since:
      1.48.0