seqeron 0.18.0
Loading...
Searching...
No Matches
Org.Limitless.Seqeron.App.Application Class Referencesealed

One replica of a co-located application — the kind of producer nothing elects. One runs per node, the topology's <applications> section names it, and LeadershipChanged already picks the replica that submits: this one publishes only while its own node leads. What that takes is behind it — the cluster session over the node's own aeron:ipc, the queue it follows, the leader gate, confirmed ingress across a failover, and the fences that say it may no longer act. More...

Inheritance diagram for Org.Limitless.Seqeron.App.Application:
Collaboration diagram for Org.Limitless.Seqeron.App.Application:

Public Member Functions

 Application (ApplicationOptions options)
 A replica configured by options ; nothing is connected until Start.
 
void Start (Aeron aeron)
 Opens the cluster session on this node and starts following its queue; the gate stays shut until caught up.
 
int DoWork ()
 One duty-cycle iteration: the cluster session and the queue, then the gate over what they left. Nothing once fenced.
 
Publish Publish (int payloadId, IDirectBuffer payload, int length)
 Submits one payload of this application's own to its own group, stamped with its sourceId and belonging to no connection.
 
Publish Publish (int payloadId, ReadOnlySpan< byte > payload)
 The same from a span, copied once into a buffer this replica owns.
 
Publish Publish (ushort groupMask, int payloadId, IDirectBuffer payload, int length)
 The same to the groups groupMask names as well as its own.
 
Publish Publish (ushort groupMask, int payloadId, ReadOnlySpan< byte > payload)
 The same from a span, copied once into a buffer this replica owns.
 
Publish Reply (ReplyAddress request, int payloadId, IDirectBuffer payload, int length)
 The same on behalf of the producer that asked for it: a reply carries the requester's sourceId, connectionId and groupMask, which is how the gateway that took the request routes the answer back out of it, and how every group that saw the request sees the answer. Keep the ReplyAddress (Payload.ReplyAddress) rather than the request itself — a Payload is valid only during its callback, and a reply is usually dispatched later.
 
Publish Reply (ReplyAddress request, int payloadId, ReadOnlySpan< byte > payload)
 The same from a span, copied once into a buffer this replica owns.
 
void Dispose ()
 Closes the cluster session and the queue. The Aeron client is the caller's and is left open.
 
void KeepAlive ()
 Tells the cluster this instance is alive. DoWork already does it once a cycle, and a snapshot round once per record; call this as well from inside an IApplicationListener callback that spins, since DoWork cannot run again until that callback returns, and the cluster drops a session that goes quiet for sequencer.sessionTimeoutMs. Self-throttling, so a call per spin costs nothing.
 

Static Public Attributes

const long DefaultQueueStallTimeoutMs = Session.DefaultQueueStallTimeoutMs
 How long the queue may be silent before this replica is fenced — 20 heartbeat periods.
 
const long DefaultRecoveryStallTimeoutMs = Session.DefaultRecoveryStallTimeoutMs
 How long recovery may dispatch nothing, once caught up before; longer, as a re-walk is slower.
 
const int DefaultPendingCapacity = Session.DefaultPendingCapacity
 Frames in flight between a publish and the queue; far above what one round trip holds.
 
const long DefaultIpcConnectTimeoutMs = 500
 How long ingress is tried on this member's own aeron:ipc: short, as a follower never answers.
 

Properties

bool CanPublish [get]
 Whether leader-only work may reach ingress right now: the gate is open, and ingress is not held.
 
bool IsLeading [get]
 Whether this replica may do leader-only work at all; CanPublish is what a publish needs.
 
int SourceId [get]
 This replica's own sourceId, the one its topology row gives it.
 
bool IsCaughtUp [get]
 
long LastClusterSeqNo [get]
 

Detailed Description

One replica of a co-located application — the kind of producer nothing elects. One runs per node, the topology's <applications> section names it, and LeadershipChanged already picks the replica that submits: this one publishes only while its own node leads. What that takes is behind it — the cluster session over the node's own aeron:ipc, the queue it follows, the leader gate, confirmed ingress across a failover, and the fences that say it may no longer act.

Off the cluster (ApplicationOptions.OffCluster), on a gateway host, it is the one instance rather than one of three: its gate opens once caught up, whoever leads, and it submits over UDP, never over a member's aeron:ipc. Nothing stops a second instance publishing too; an application that needs a standby off the cluster is a Gateway.

What is left to the consumer is its own work: the payloads it reads, the state it keeps, the payloads it submits. Every replica reads the same ordered stream and so holds the same state, which is what makes OutstandingWork<TKey,TWork> — fed that same stream — the way work survives the gate closing under it.

Snapshots (doc/snapshot.md §4): given an ISnapshotListener and a topology row with snapshot="true", every replica serializes its state at each round's cut into its own directory, and the one whose gate is open then submits the round's SnapshotEnd. A replica whose snapshot differs from the one sequenced is fenced with ClusterError.SnapshotDiverged. On start, a replica given a listener restores the newest snapshot of its own that the log confirms and resumes after its cut, or replays from clusterSeqNo 1 without one; one it cannot restore is fenced with ClusterError.SnapshotUnrestorable.

Single-threaded: every member belongs to the caller's one duty-cycle thread, which calls DoWork each iteration. Application.java and app/Application.hpp are its twins; keep the three in step.

Constructor & Destructor Documentation

◆ Application()

Org.Limitless.Seqeron.App.Application.Application ( ApplicationOptions  options)
inline

A replica configured by options ; nothing is connected until Start.

Exceptions
ArgumentExceptionif a required option is missing

Member Function Documentation

◆ Dispose()

void Org.Limitless.Seqeron.App.Application.Dispose ( )
inline

Closes the cluster session and the queue. The Aeron client is the caller's and is left open.

◆ DoWork()

int Org.Limitless.Seqeron.App.Application.DoWork ( )
inline

One duty-cycle iteration: the cluster session and the queue, then the gate over what they left. Nothing once fenced.

Returns
units of work done, for the caller's idle strategy

◆ KeepAlive()

void Org.Limitless.Seqeron.App.Application.KeepAlive ( )
inline

Tells the cluster this instance is alive. DoWork already does it once a cycle, and a snapshot round once per record; call this as well from inside an IApplicationListener callback that spins, since DoWork cannot run again until that callback returns, and the cluster drops a session that goes quiet for sequencer.sessionTimeoutMs. Self-throttling, so a call per spin costs nothing.

◆ Publish() [1/4]

Publish Org.Limitless.Seqeron.App.Application.Publish ( int  payloadId,
IDirectBuffer  payload,
int  length 
)
inline

Submits one payload of this application's own to its own group, stamped with its sourceId and belonging to no connection.

Parameters
payloadIdwhich protocol the payload speaks
payloadthe payload's bytes from offset 0, its own MessageHeader included
lengthbytes of payload
Returns
Declined while the gate is shut, ingress is held or the transport is back-pressured — retry it; Refused is permanent

◆ Publish() [2/4]

Publish Org.Limitless.Seqeron.App.Application.Publish ( int  payloadId,
ReadOnlySpan< byte >  payload 
)
inline

The same from a span, copied once into a buffer this replica owns.

◆ Publish() [3/4]

Publish Org.Limitless.Seqeron.App.Application.Publish ( ushort  groupMask,
int  payloadId,
IDirectBuffer  payload,
int  length 
)
inline

The same to the groups groupMask names as well as its own.

Parameters
groupMaskbits from the GroupDirectory; one the table lacks is Refused
payloadIdwhich protocol the payload speaks
payloadthe payload's bytes from offset 0, its own MessageHeader included
lengthbytes of payload

◆ Publish() [4/4]

Publish Org.Limitless.Seqeron.App.Application.Publish ( ushort  groupMask,
int  payloadId,
ReadOnlySpan< byte >  payload 
)
inline

The same from a span, copied once into a buffer this replica owns.

◆ Reply() [1/2]

Publish Org.Limitless.Seqeron.App.Application.Reply ( ReplyAddress  request,
int  payloadId,
IDirectBuffer  payload,
int  length 
)
inline

The same on behalf of the producer that asked for it: a reply carries the requester's sourceId, connectionId and groupMask, which is how the gateway that took the request routes the answer back out of it, and how every group that saw the request sees the answer. Keep the ReplyAddress (Payload.ReplyAddress) rather than the request itself — a Payload is valid only during its callback, and a reply is usually dispatched later.

◆ Reply() [2/2]

Publish Org.Limitless.Seqeron.App.Application.Reply ( ReplyAddress  request,
int  payloadId,
ReadOnlySpan< byte >  payload 
)
inline

The same from a span, copied once into a buffer this replica owns.

◆ Start()

void Org.Limitless.Seqeron.App.Application.Start ( Aeron  aeron)
inline

Opens the cluster session on this node and starts following its queue; the gate stays shut until caught up.

Member Data Documentation

◆ DefaultIpcConnectTimeoutMs

const long Org.Limitless.Seqeron.App.Application.DefaultIpcConnectTimeoutMs = 500
static

How long ingress is tried on this member's own aeron:ipc: short, as a follower never answers.

◆ DefaultPendingCapacity

const int Org.Limitless.Seqeron.App.Application.DefaultPendingCapacity = Session.DefaultPendingCapacity
static

Frames in flight between a publish and the queue; far above what one round trip holds.

◆ DefaultQueueStallTimeoutMs

const long Org.Limitless.Seqeron.App.Application.DefaultQueueStallTimeoutMs = Session.DefaultQueueStallTimeoutMs
static

How long the queue may be silent before this replica is fenced — 20 heartbeat periods.

◆ DefaultRecoveryStallTimeoutMs

const long Org.Limitless.Seqeron.App.Application.DefaultRecoveryStallTimeoutMs = Session.DefaultRecoveryStallTimeoutMs
static

How long recovery may dispatch nothing, once caught up before; longer, as a re-walk is slower.

Property Documentation

◆ CanPublish

bool Org.Limitless.Seqeron.App.Application.CanPublish
get

Whether leader-only work may reach ingress right now: the gate is open, and ingress is not held.

◆ IsCaughtUp

bool Org.Limitless.Seqeron.App.Application.IsCaughtUp
get

◆ IsLeading

bool Org.Limitless.Seqeron.App.Application.IsLeading
get

Whether this replica may do leader-only work at all; CanPublish is what a publish needs.

◆ LastClusterSeqNo

long Org.Limitless.Seqeron.App.Application.LastClusterSeqNo
get

◆ SourceId

int Org.Limitless.Seqeron.App.Application.SourceId
get

This replica's own sourceId, the one its topology row gives it.


The documentation for this class was generated from the following file: