class: Splitter
[38:7] extends: object
Splitter breaks one message into a list of split messages, stamping each piece with the correlation and sequence metadata the Aggregator needs to put them back together. A split message is a native Aussom map with four keys: correlationId, sequenceNumber (1..sequenceSize), sequenceSize, and payload (the piece, any Aussom value). The Splitter is stateless and one instance can be reused for many splits.
Members
-
splitFn
Optional split-function callback that turns a composite payload into a list of pieces.
Methods
-
Splitter (
SplitFn = null)Constructs a Splitter. With no split function the input to split() must already be a list of pieces; with one, split() calls it to produce the list of pieces from a composite payload.
- @p
SplitFnis an optional split-function callback (default null).
- @p
-
split (
Payload, CorrelationId = null)Breaks Payload into a list of split messages. The pieces are the list returned by the split function, or Payload itself when no split function is set (in which case Payload must be a list). Each piece is stamped with the correlation id (a fresh one when CorrelationId is null), a sequenceNumber from 1 to the piece count, and the piece count as sequenceSize. An empty list of pieces returns an empty list.
- @p
Payloadis the message to split. - @p
CorrelationIdis an optional correlation id to stamp (default null, which generates a fresh one). - @r
Alist of split-message maps in piece order.
- @p
class: Aggregator
[106:14] (extern: com.lehman.aussom.Aggregator) extends: object
Aggregator collects related split messages by correlation id into groups and, once a group is complete, hands the reassembled payloads to the onComplete callback. It is an Aussom Server client listener: register it with app.registerListener and the server runtime runs its background reaper on a dedicated thread. Pieces are fed in with aggregate() from any thread. The completion strategy is set with setCompletion: "count" (default, completes when every piece in the splitter's sequence has arrived), "predicate" (a callback decides), or "timeout" (a time window). A timeout also guards the count and predicate strategies against a piece that never arrives, evicting the group and firing onTimeout.
Methods
-
Aggregator (
string Name)Creates a new Aggregator.
- @p
Nameis the stable listener name used in logs and applications.yaml.
- @p
-
newAggregator (
string Name) -
setCompletion (
string Strategy)Sets the completion strategy.
- @p
Strategyis "count" (default), "predicate", or "timeout". - @r
thisobject
- @p
-
setCompletionCallback (
callback Cb)Sets the completion predicate, called as Cb(CorrelationId, Payloads) after each piece; a true return completes the group. Required for the predicate strategy.
- @p
Cbis the predicate callback. - @r
thisobject
- @p
-
setTimeoutMs (
int Ms)Sets the group lifetime in milliseconds. Required for the timeout strategy; an optional safety net (eviction) otherwise.
- @p
Msis an int with the group lifetime in milliseconds. - @r
thisobject
- @p
-
setReapIntervalMs (
int Ms)Sets how often the reaper sweeps for timed-out groups. Default 1000 ms.
- @p
Msis an int with the sweep interval in milliseconds. - @r
thisobject
- @p
-
setOnComplete (
callback Cb)Sets the completion handler, called as Cb(CorrelationId, Payloads) with the reassembled payloads when a group completes. Required.
- @p
Cbis the completion handler callback. - @r
thisobject
- @p
-
setOnTimeout (
callback Cb)Sets the timeout handler, called as Cb(CorrelationId, Payloads) for a group evicted by timeout under the count/predicate strategies. Optional.
- @p
Cbis the timeout handler callback. - @r
thisobject
- @p
-
aggregate (
Part)Feeds one split message into its group. Under the count and predicate strategies a completed group fires onComplete on the calling thread.
- @p
Partis a split-message map (correlationId, payload, and optional sequenceNumber/sequenceSize). - @r
thisobject
- @p
-
startListener ()
Runs the reaper loop on the calling thread, blocking until stopListener() is called. Under Aussom Server the runtime drives this after app.registerListener; called directly for plain-CLI use and tests.
- @r
thisobject
- @r
-
stopListener ()
Signals the reaper loop to exit.
- @r
thisobject
- @r
-
pauseListener ()
Pauses the timeout sweeps without dropping group state.
- @r
thisobject
- @r
-
resumeListener ()
Resumes the timeout sweeps after pauseListener().
- @r
thisobject
- @r
-
getListenerName ()
Gets the aggregator (listener) name.
- @r
Astring with the name.
- @r
-
getIsRunning ()
Reports whether the reaper loop is running.
- @r
Abool, true while running.
- @r
-
getIsPaused ()
Reports whether the reaper is paused.
- @r
Abool, true while paused.
- @r
class: integration_splitter_aggregator_module
[24:14] static extends: object
Module JAR loader class. Loads the bundled jar that backs the Aggregator before any extern class resolves.
Methods
- integration_splitter_aggregator_module ()