Class Application.Builder

java.lang.Object
org.limitless.seqeron.app.Application.Builder
Enclosing class:
Application

public static final class Application.Builder extends Object
Everything one replica needs to join its deployment.
  • Constructor Details

    • Builder

      public Builder()
  • Method Details

    • sourceId

      public Application.Builder sourceId(int sourceId)
      This application's sourceId, the one its <applications> row declares — required, because spec §5 is one id space, and never −1, which ingress refuses.
    • addressedGroups

      public Application.Builder addressedGroups(String... addressedGroups)
      The names of the groups this application publishes to besides its own; one the log's group table lacks fences it with ClusterError.GROUP_UNKNOWN.
    • clientId

      public Application.Builder clientId(int clientId)
      This replica's client id, its counters' label — required, and unique among the clients on its node: two sharing one share their counters' series.
    • memberId

      public Application.Builder memberId(int memberId)
      The node this replica runs on: whose queue it follows, and whose leadership opens its gate.
    • egressChannel

      public Application.Builder egressChannel(String egressChannel)
      This client's own egress endpoint; two media drivers on one host cannot both bind a port. An ephemeral port on localhost, aeron:udp?endpoint=localhost:0, by default.
    • ingressEndpoints

      public Application.Builder ingressEndpoints(String ingressEndpoints)
      The members to reach when this node is not leading, PortLayout.ingressEndpoints() by default.
    • listener

      public Application.Builder listener(Application.Listener listener)
    • outstandingWork

      public Application.Builder outstandingWork(OutstandingWork<?,?> outstandingWork)
      The tracker of this application's leader-only work. The façade calls its OutstandingWork.onNotLeader() whenever the gate closes, before Application.Listener.onLeadershipChanged(boolean), so the listener need not. Optional: without one the listener does it.
    • snapshots

      public Application.Builder snapshots(SnapshotListener snapshotListener, Path snapshotDirectory)
      Takes this replica into snapshot rounds; without it it takes part in none, whatever its topology row says, and recovers from clusterSeqNo 1.
      Parameters:
      snapshotListener - serializes this application's state for a round and restores it on start
      snapshotDirectory - where this replica keeps its snapshots, one file per round. Its own: no other instance may write it. A restart restores from what it holds, so it must outlive the process.
    • tuning

      public Application.Builder tuning(Tuning tuning)
      The stall and capacity policy, Tuning.DEFAULT by default.
    • idleStrategy

      public Application.Builder idleStrategy(org.agrona.concurrent.IdleStrategy idleStrategy)
      What a call that blocks waits on between attempts: a publish that spins through an election, up to 10 s, and the cluster connect in start. A yielding spin and Aeron's own connect wait by default. One that also does the caller's periodic work, such as writing a heartbeat, keeps it going while the call blocks.
    • offCluster

      public Application.Builder offCluster(boolean offCluster)
      Whether this node is a gateway host, running no member, rather than a member: the gate then opens whoever leads, and ingress is UDP alone. Run one instance, as nothing elects between two. Not with an ipcConnectTimeoutMs, which has no IPC ingress to time.
    • ipcConnectTimeoutMs

      public Application.Builder ipcConnectTimeoutMs(long ipcConnectTimeoutMs)
      How long to wait for IPC ingress to the local member while it leads before using UDP, 500L ms by default. Not with offCluster.
    • build

      public Application build()