msg-funnel


This component is for asynchronous messages only.

Component "funnel" is for filtering concurrent messages at specific integration point. This filtering ensures that only one message at one moment will be processed, even in garanteed order (optional choice).

Usage example: if external system can process only one request for specific customer then you need to filter outgoing requests to this system.

Msg-funnel component uses funnel value for finding out if two or more concurrent messages impact identical object. Funnel value can be anything, e.g. customer ID, subscriber mobile number, custom string etc.

Funnel value is taken from AsynchConstants.FUNNEL_VALUE_HEADER header value - can be set explicitly or use org.openhubframework.openhub.api.asynch.AsynchRouteBuilder class for simpler route implementation.


If there is processing message and this component detects different concurrent message(s) with the same funnel value that is also processed (message in states PROCESSING, WAITING and WAITING_FOR_RES) then processing of current message is postponed (changed state to POSTPONED). This message will stay in this state for certain moment (configuration parameter asynch.postponedInterval) and then will try it to process again.

 

Component is working in two modes (according to the parameter guaranteedOrder):

  • classic funnel - component checks concurrent messages and ensures that only one message at one time will be processed. This is default mode, parameter guaranteedOrder is false.
  • guaranteed funnel - if parameter guaranteedOrder is true, then component garantees processing order of message (by msgTimestamp) on top of that. Component in this mode takes into consideration messages in other states (PARTLY_FAILED, FAILED and POSTPONED) because it's necessary to guarantee processing order among all messages with same funnel value.

 

See guaranteed message processing order functionality when you want to gaurantee order on the level of the whole routes.

URI format

msg-funnel:default[?options]

Options

ParameterDefaultDescription
idleInterval600

Interval in seconds how long can be message be processing (= be in state PROCESSING). In other words during this interval will be message considered as being processed.

This is for cases when processing message can be locked during processing, forexample in communication with external system that doesn't respond (message will stay in WAITING_FOR_RES state)

guaranteedOrderfalse

True if funnel component should guaranteed order of processing messages. By default funnel works with running messages (PROCESSING, WAITING, WAITING_FOR_RES) only and if it's necessary to guarantee processing order then also PARTLY_FAILED, FAILED and POSTPONED messages should be involved.

excludeFailedStatefalse

Messages in FAILED state are taking into consideration for guaranteed order by default. If you want to exclude this state then set this parameter to true.

Value of this parameter has sense only when guaranteedOrder is true.

idroute_id

Funnel identifier that specifies unique point during message processing. Messages are checked and filtered out to this point.

If not defined then identifier is derived from route ID (that is unique in one Camel context) where this component is placed. Set this parameter is necessary in practice only when more funnel components are used in one route. 

Examples

msg-funnel:default?idleInterval=1000