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_MESSAGES starts rejecting new messages.

  • DISCARD_WINDOW deletes 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

numberOfMessages

Required along with periodInSeconds to configure the aggregation of fragments for a number of messages or a period of time in seconds, whichever comes first, depending on the rate of messages.

periodInSeconds

Required along with numberOfMessages to configure the aggregation of fragments for a number of messages or a period of time in seconds, whichever comes first, depending on the rate of messages.

timeWindowStartOnFirstMessage

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 false (i.e., a new window is immediately opened).

aggregationFailureStrategy

Determines what the source does if it cannot create a window’s aggregate or deliver it to the flow for processing after aggregationFailureMaxRetries retries. Before retries are exhausted, the source continues accepting new messages and delivering later windows under either strategy.

  • REJECT_NEW_MESSAGES: Retain the window and continue retrying it. Reject new messages with a transient NACK until the aggregate is delivered. Messages already stored in the source are retained, but upstream attempts to hand off new messages fail. The upstream flow retries rejected messages according to its redeliveryStrategy. When those retries are exhausted, it sends the rejected messages to its configured dead-letter flow, or discards them if none is configured. Rejection continues indefinitely if the failure remains unresolved.

  • DISCARD_WINDOW: Delete the window’s messages and report the loss as a connector error. These messages are permanently lost. The source continues accepting new messages.

If a window’s failure cannot be resolved, either of the following actions ends rejection of new messages:

  • Update the flow with aggregationFailureStrategy = DISCARD_WINDOW. By default, a flow update retains stored messages ( sourceUpdateStrategy = Resume). The source then discards the failed window, permanently losing its messages.

  • Force-delete the flow. All messages stored in the source are permanently lost.

Optional. Defaults to REJECT_NEW_MESSAGES.

aggregationFailureMaxRetries

Number of retries after a window’s first failed attempt, before aggregationFailureStrategy applies. 0 means the strategy applies after the first failure.

Optional. Defaults to 10. Must not be negative.

aggregationFailureRetryDelayMillis

Delay in milliseconds before the first retry of a failed window. The delay increases with each retry, up to aggregationFailureMaxRetryDelayMillis.

Optional. Defaults to 300000 (5 minutes). Must be positive.

aggregationFailureMaxRetryDelayMillis

Maximum delay in milliseconds between retries of a failed window. With REJECT_NEW_MESSAGES, the source continues retrying at this delay after aggregationFailureMaxRetries retries are exhausted.

Optional. Defaults to 600000 (10 minutes). Must be positive, and must not be below aggregationFailureRetryDelayMillis when both are set. If only one property is set, the other uses its default. If the resulting maximum delay is below the initial delay, the source raises the effective maximum to the initial delay. Setting only aggregationFailureRetryDelayMillis above 600000 makes that value both the initial and maximum delay. Setting only this property below 300000`results in a fixed retry delay of `300000 milliseconds (5 minutes), the default initial delay, without increasing the delay.

name

Optional, descriptive name for the processor.

id

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 [a-zA-Z][a-zA-Z0-9_-]{2,29}.

exchangeProperties

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

messageLoggingStrategy

Strategy for describing how a processor’s message is logged on the server.

payloadArchivingStrategy

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.