Class AeronCluster.Context
- All Implemented Interfaces:
Cloneable
- Enclosing class:
- AeronCluster
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaeron()Aeronclient for communicating with the local Media Driver.Aeronclient for communicating with the local Media Driver.Get the top level Aeron directory used for communication between the Aeron client and Media Driver.aeronDirectoryName(String aeronDirectoryName) Set the top level Aeron directory used for communication between the Aeron client and Media Driver.Get theAgentInvokerto be invoked in addition to any invoker used by theaeron()instance.agentInvoker(AgentInvoker agentInvoker) Set theAgentInvokerto be invoked in addition to any invoker used by theaeron()instance.Returns the name of this Cluster client.clientName(String clientName) Sets the name used to identify this client among other clients connected to the Cluster.clone()Perform a shallow copy of the object.voidclose()Close the context and free applicable resources.voidconclude()Conclude configuration by setting up defaults when specifics are not provided.Get theControlledEgressListenerfunction that will be called when polling for egress viaAeronCluster.controlledPollEgress().Set theControlledEgressListenerfunction that will be called when polling for egress viaAeronCluster.controlledPollEgress().Get theCredentialsSupplierto be used for authentication with the cluster.credentialsSupplier(CredentialsSupplier credentialsSupplier) Set theCredentialsSupplierto be used for authentication with the cluster.Get the channel parameter for the egress channel.egressChannel(String channel) Set the channel parameter for the egress channel.Get theEgressListenerfunction that will be called when polling for egress viaAeronCluster.pollEgress().egressListener(EgressListener listener) Set theEgressListenerfunction that will be called when polling for egress viaAeronCluster.pollEgress().intGet the stream id for the egress channel.egressStreamId(int streamId) Set the stream id for the egress channel.Get theErrorHandlerto be used for handling any exceptions.errorHandler(ErrorHandler errorHandler) Set theErrorHandlerto be used for handling any exceptions.Get theIdleStrategyused when waiting for responses.idleStrategy(IdleStrategy idleStrategy) Set theIdleStrategyused when waiting for responses.Get the channel parameter for the ingress channel.ingressChannel(String channel) Set the channel parameter for the ingress channel.The endpoints representing members for use with unicast to be substituted into theingressChannel()for endpoints.ingressEndpoints(String clusterMembers) The endpoints representing members for use with unicast to be substituted into theingressChannel()for endpoints.intGet the stream id for the ingress channel.ingressStreamId(int streamId) Set the stream id for the ingress channel.booleanHas the context had theconclude()method called.booleanAre direct buffers used for fragment assembly on egress?isDirectAssemblers(boolean isDirectAssemblers) Are direct buffers used for fragment assembly on egress?booleanIs ingress thePublicationto the cluster used exclusively from a single thread to this client?isIngressExclusive(boolean isIngressExclusive) Is ingress to the cluster exclusively from a single thread to this client? The client should not be used from another thread, e.g.longThe message timeout in nanoseconds to wait for sending or receiving a message.messageTimeoutNs(long messageTimeoutNs) Set the message timeout in nanoseconds to wait for sending or receiving a message.longThe timeout to wait for a new leader after noticing a disconnection from the previous one.newLeaderTimeoutNs(long newLeaderTimeoutNs) The timeout to wait for a new leader after noticing a disconnection from the previous one.booleanDoes this context own theaeron()client and this takes responsibility for closing it?ownsAeronClient(boolean ownsAeronClient) Does this context own theaeron()client and this takes responsibility for closing it?toString()
-
Constructor Details
-
Context
public Context()
-
-
Method Details
-
clone
Perform 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 theconclude()method called.- Returns:
- true if the
conclude()method has been called.
-
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:
-
newLeaderTimeoutNs
The timeout to wait for a new leader after noticing a disconnection from the previous one. Upon timeout the cluster will be considered lost and the client will close. If set toAeron.NULL_VALUE, a reasonable default will be used.- Parameters:
newLeaderTimeoutNs- the new leader timeout in nanoseconds orAeron.NULL_VALUE.- Returns:
- this for a fluent API.
-
newLeaderTimeoutNs
public long newLeaderTimeoutNs()The timeout to wait for a new leader after noticing a disconnection from the previous one. Upon timeout the cluster will be considered lost and the client will close.- Returns:
- the new leader timeout in nanoseconds.
-
ingressEndpoints
The endpoints representing members for use with unicast to be substituted into theingressChannel()for endpoints. A null value can be used when multicast where theingressChannel()contains the multicast endpoint.- Parameters:
clusterMembers- which are all candidates to be leader.- Returns:
- this for a fluent API.
- See Also:
-
ingressEndpoints
The endpoints representing members for use with unicast to be substituted into theingressChannel()for endpoints. A null value can be used when multicast where theingressChannel()contains the multicast endpoint.- Returns:
- member endpoints of the cluster which are all candidates to be leader.
- See Also:
-
ingressChannel
Set the channel parameter for the ingress channel.The endpoints representing members for use with unicast are substituted from
ingressEndpoints()for endpoints. If this channel contains a multicast endpoint, theningressEndpoints()should be set to null.- Parameters:
channel- parameter for the ingress channel.- Returns:
- this for a fluent API.
- See Also:
-
ingressChannel
Get the channel parameter for the ingress channel.The endpoints representing members for use with unicast are substituted from
ingressEndpoints()for endpoints. A null value can be used when multicast where this contains the multicast endpoint.- Returns:
- the channel parameter for the ingress channel.
- See Also:
-
ingressStreamId
Set the stream id for the ingress channel.- Parameters:
streamId- for the ingress channel.- Returns:
- this for a fluent API
- See Also:
-
ingressStreamId
public int ingressStreamId()Get the stream id for the ingress channel.- Returns:
- the stream id for the ingress channel.
- See Also:
-
egressChannel
Set the channel parameter for the egress channel.- Parameters:
channel- parameter for the egress channel.- Returns:
- this for a fluent API.
- See Also:
-
egressChannel
Get the channel parameter for the egress channel.- Returns:
- the channel parameter for the egress channel.
- See Also:
-
egressStreamId
Set the stream id for the egress channel.- Parameters:
streamId- for the egress channel.- Returns:
- this for a fluent API
- See Also:
-
egressStreamId
public int egressStreamId()Get the stream id for the egress channel.- Returns:
- the stream id for the egress channel.
- See Also:
-
idleStrategy
Set theIdleStrategyused when waiting for responses.- Parameters:
idleStrategy- used when waiting for responses.- Returns:
- this for a fluent API.
-
idleStrategy
Get theIdleStrategyused when waiting for responses.- Returns:
- the
IdleStrategyused when waiting for responses.
-
clientName
Sets the name used to identify this client among other clients connected to the Cluster.- Parameters:
clientName- to use.- Returns:
- this for a fluent API.
- Since:
- 1.49.0
- See Also:
-
clientName
Returns the name of this Cluster client.- Returns:
- name of this client or empty String if not configured.
- Since:
- 1.49.0
- See Also:
-
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
Get the top level Aeron directory used for communication between the Aeron client and Media Driver.- Returns:
- The top level Aeron directory.
-
aeron
Aeronclient for communicating with the local Media Driver.This client will be closed when the
AeronCluster.close()orclose()methods are called ifownsAeronClient()is true.- Parameters:
aeron- client for communicating with the local Media Driver.- Returns:
- this for a fluent API.
- See Also:
-
aeron
Aeronclient for communicating with the local Media Driver.If not provided then a default will be established during
conclude()by callingAeron.connect().- Returns:
- client for communicating with the local Media Driver.
-
ownsAeronClient
Does this context own theaeron()client and this takes responsibility for closing it?- Parameters:
ownsAeronClient- does this context own theaeron()client.- Returns:
- this for a fluent API.
-
ownsAeronClient
public boolean ownsAeronClient()Does this context own theaeron()client and this takes responsibility for closing it?- Returns:
- does this context own the
aeron()client and this takes responsibility for closing it?
-
isIngressExclusive
Is ingress to the cluster exclusively from a single thread to this client? The client should not be used from another thread, e.g. a separate thread callingAeronCluster.sendKeepAlive()- which is awful design by the way!- Parameters:
isIngressExclusive- true if ingress to the cluster is exclusively from a single thread for this client?- Returns:
- this for a fluent API.
-
isIngressExclusive
public boolean isIngressExclusive()Is ingress thePublicationto the cluster used exclusively from a single thread to this client?- Returns:
- true if the ingress
Publicationis to be used exclusively from a single thread?
-
credentialsSupplier
Set theCredentialsSupplierto be used for authentication with the cluster.- Parameters:
credentialsSupplier- to be used for authentication with the cluster.- Returns:
- this for fluent API.
-
credentialsSupplier
Get theCredentialsSupplierto be used for authentication with the cluster.- Returns:
- the
CredentialsSupplierto be used for authentication with the cluster.
-
errorHandler
Set theErrorHandlerto be used for handling any exceptions.- Parameters:
errorHandler- Method to handle objects of type Throwable.- Returns:
- this for fluent API.
-
errorHandler
Get theErrorHandlerto be used for handling any exceptions.- Returns:
- The
ErrorHandlerto be used for handling any exceptions.
-
isDirectAssemblers
Are direct buffers used for fragment assembly on egress?- Parameters:
isDirectAssemblers- true if direct buffers used for fragment assembly on egress.- Returns:
- this for a fluent API.
-
isDirectAssemblers
public boolean isDirectAssemblers()Are direct buffers used for fragment assembly on egress?- Returns:
- true if direct buffers used for fragment assembly on egress.
-
egressListener
Set theEgressListenerfunction that will be called when polling for egress viaAeronCluster.pollEgress().Only
EgressListener.onMessage(long, long, DirectBuffer, int, int, Header)will be dispatched when usingAeronCluster.pollEgress().- Parameters:
listener- function that will be called when polling for egress viaAeronCluster.pollEgress().- Returns:
- this for a fluent API.
-
egressListener
Get theEgressListenerfunction that will be called when polling for egress viaAeronCluster.pollEgress().- Returns:
- the
EgressListenerfunction that will be called when polling for egress viaAeronCluster.pollEgress().
-
controlledEgressListener
Set theControlledEgressListenerfunction that will be called when polling for egress viaAeronCluster.controlledPollEgress().Only
ControlledEgressListener.onMessage(long, long, DirectBuffer, int, int, Header)will be dispatched when usingAeronCluster.controlledPollEgress().- Parameters:
listener- function that will be called when polling for egress viaAeronCluster.controlledPollEgress().- Returns:
- this for a fluent API.
-
controlledEgressListener
Get theControlledEgressListenerfunction that will be called when polling for egress viaAeronCluster.controlledPollEgress().- Returns:
- the
ControlledEgressListenerfunction that will be called when polling for egress viaAeronCluster.controlledPollEgress().
-
agentInvoker
Set theAgentInvokerto be invoked in addition to any invoker used by theaeron()instance.Useful for when running on a low thread count scenario.
Note: it is the responsibility of the user to call
agentInvokerand theaeron.conductorAgentInvoker()periodically.- Parameters:
agentInvoker- to be invoked while awaiting a response in the client or when awaiting completion.- Returns:
- this for a fluent API.
-
agentInvoker
Get theAgentInvokerto be invoked in addition to any invoker used by theaeron()instance.- Returns:
- the
AgentInvokerthat is used.
-
close
public void close()Close the context and free applicable resources.If
ownsAeronClient()is true then theaeron()client will be closed. -
toString
-