windowedAggregationHandoff
Source processor and specialized variant of handoff.
It must be the first processor in a flow, has no external endpoint, and can receive messages only from a distribute or split processor in an upstream flow.
Unlike handoff, which processes each incoming message individually, windowedAggregationHandoff collects incoming messages into a window and processes them as a batch when either the configured message count or time period is reached, whichever occurs first.
Like handoff, a windowedAggregationHandoff flow provides its own delivery guarantee for the messages it accepts. Each incoming message is persisted at the source before being held for aggregation. This persistence enables redelivery and dead letter handling of the aggregate in this flow.
windowedAggregationHandoff flows must use exchangePattern = OneWay. The upstream flow hands off each incoming message and receives an ACK once the source has stored it. It does not wait for the window to close or for batch processing to complete.
If the source cannot create a window’s aggregate or deliver it to the flow for processing, it retries. aggregationFailureStrategy determines what happens when retries are exhausted. With REJECT_NEW_MESSAGES (the default), the source rejects new incoming messages with a transient NACK until the aggregate is successfully delivered. The upstream flow handles these rejected messages according to its redeliveryStrategy and deadLetterStrategy.
The source reports each of these as a connector error, which shows in the Console’s flow traces:
-
A window runs out of retries.
-
REJECT_NEW_MESSAGESstarts rejecting new messages. -
DISCARD_WINDOWdeletes a window. The connector error states how many messages are lost.
When this flow’s deadLetterStrategy sets forwardNonMessageRelatedErrors, its dead-letter flow also receives these connector errors. Each names the window but does not contain its messages, so the dead-letter flow cannot recover lost messages.
When a flow server leaves the cluster, another flow server takes over the windows the source stored on it, delivers them, and then deletes them. Under DISCARD_WINDOW, the takeover ends once every window is delivered or discarded. Under REJECT_NEW_MESSAGES, it lasts until every window is delivered, however long that takes.
Properties
| Name | Summary |
|---|---|
|
Required along with |
|
Required along with |
|
Whether the time window should start on the first reception of a message after a window has been closed or immediately open a new window when the previous one is closed. Optional and defaults to |
|
Determines what the source does if it cannot create a window’s aggregate or deliver it to the flow for processing after
If a window’s failure cannot be resolved, either of the following actions ends rejection of new messages:
Optional. Defaults to |
|
Number of retries after a window’s first failed attempt, before Optional. Defaults to |
|
Delay in milliseconds before the first retry of a failed window. The delay increases with each retry, up to Optional. Defaults to |
|
Maximum delay in milliseconds between retries of a failed window. With Optional. Defaults to |
|
Optional, descriptive name for the processor. |
|
Required identifier of the processor, unique across all processors within the flow. Must be between 3 and 30 characters long; contain only lower and uppercase alphabetical characters (a-z and A-Z), numbers, dashes ("-"), and underscores ("_"); and start with an alphabetical character. In other words, it adheres to the regex pattern |
|
Optional set of custom properties in a simple jdk-format, that are added to the message exchange properties before processing the incoming payload. Any existing properties with the same name will be replaced by properties defined here. |
Sub-builders
| Name | Summary |
|---|---|
Strategy for describing how a processor’s message is logged on the server. |
|
Strategy for archiving payloads. |
Details
Usage
Both the distribute and split processors support windowed aggregation handoffs to flows. The handoff flow would then be configured in a manner similar to the following:
flowConfig {
id = "message-aggregation-flow"
description = "Message Aggregation Handoff Flow"
ownerId = "my-company"
exchangePattern = FlowExchangePattern.OneWay
windowedAggregationHandoff {
id = "windowed-aggregation-handoff-source"
numberOfMessages = 5L
periodInSeconds = 2L
}
restRequest {
id = "send-http-request"
defaultMethod = POST
address = URL("https://my/url")
}
}
In the main flow, the initiating processor then references the same flow ID. For example:
distribute {
id = "distribute-message"
flowId("message-aggregation-flow")
}
Caveats
It is important to note that this aggregating source, like all other parts of Utilihive message processing, is subject to at-least-once delivery and eventual consistency semantics.
You cannot, for instance, set up a window for 24 hours and expect exactly 1 aggregate per 24 hours containing exactly every fragment received in that period.
The aggregation is done on a best-effort basis.
With aggregationFailureStrategy = REJECT_NEW_MESSAGES (the default), the source retains all fragments it has accepted.
With DISCARD_WINDOW, the source discards a window’s fragments when the window exhausts its retries.
Fragments might be redelivered or arrive out of order.
Aggregates might be produced at unexpected times, and they might contain message duplicates.
Also, the aggregating source is not a singleton, so you will get one aggregate per server node.
In short: it is not intended as a tool to create large atomic transactions consisting of a predictable set of messages but as a tool for grouping messages into sensibly sized chunks on a best-effort basis.
Expecting consistent atomic aggregates with in-order messages is, in general, not a good design approach for integration flows. Upstream systems might produce out of order or heavily delayed messages, and downstream systems might temporarily reject some aggregates while accepting others. In such scenarios, the at-least-once delivery and eventual consistency guarantees of Utilihive are a good approach to ensure that all messages are delivered eventually. The only external requirement is that the downstream systems must handle duplicate messages.
It is also important to note that for some flow-server deployments, there is a size restriction on the fragments and the threshold is determined by the flow-server configuration. If the size of a fragment exceeds the configured threshold, the fragment will be rejected and an error will be reported. Please make sure that the size of the fragments to be aggregated is within the configured threshold of the flow-server deployment. This size threshold can be obtained from Utilihive support for the multi-tenant deployment or your operations team for the on-premise deployment.