Package io.aeron.cluster.client
Class IngressSessionDecorator
java.lang.Object
io.aeron.cluster.client.IngressSessionDecorator
Encapsulate applying a client message header for ingress to the cluster.
The client message header is applied to the Publication before the offered buffer.
Note: This class is NOT threadsafe for updating clusterSessionId(long) or
leadershipTermId(long). Each publisher thread requires its own instance.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intLength of the session header that will be prepended to the message. -
Constructor Summary
ConstructorsConstructorDescriptionConstruct a new ingress session header wrapper that defaults all fields toAeron.NULL_VALUE.IngressSessionDecorator(long clusterSessionId, long leadershipTermId) Construct a new session header wrapper. -
Method Summary
Modifier and TypeMethodDescriptionclusterSessionId(long clusterSessionId) Reset the cluster session id in the header.leadershipTermId(long leadershipTermId) Reset the leadership term id in the header.longoffer(Publication publication, DirectBuffer buffer, int offset, int length) Non-blocking publish of a partial buffer containing a message plus session header to a cluster.
-
Field Details
-
HEADER_LENGTH
public static final int HEADER_LENGTHLength of the session header that will be prepended to the message.- See Also:
-
-
Constructor Details
-
IngressSessionDecorator
public IngressSessionDecorator()Construct a new ingress session header wrapper that defaults all fields toAeron.NULL_VALUE. -
IngressSessionDecorator
public IngressSessionDecorator(long clusterSessionId, long leadershipTermId) Construct a new session header wrapper.- Parameters:
clusterSessionId- that has been allocated by the cluster.leadershipTermId- of the current leader.
-
-
Method Details
-
clusterSessionId
Reset the cluster session id in the header.- Parameters:
clusterSessionId- to be set in the header.- Returns:
- this for a fluent API.
-
leadershipTermId
Reset the leadership term id in the header.- Parameters:
leadershipTermId- to be set in the header.- Returns:
- this for a fluent API.
-
offer
Non-blocking publish of a partial buffer containing a message plus session header to a cluster.This version of the method will set the timestamp value in the header to
Aeron.NULL_VALUE.- Parameters:
publication- to be offered to.buffer- containing message.offset- offset in the buffer at which the encoded message begins.length- in bytes of the encoded message.- Returns:
- the same as
Publication.offer(DirectBuffer, int, int).
-