OpenHub framework allows to garant processing order of messages. This functionality garants that incoming messages with the same funnel_value will start processing in order by msgTimestamp (timestamp from source system) and next message won't start before previous message isn't finished.

Guaranteed message processing order takes all the following states into consideration: PROCESSINGWAITINGWAITING_FOR_RES, PARTLY_FAILED, FAILED and POSTPONED. FAILED state is used by default but can be excluded. 


It can happen that first message failed and then all next messages will wait to start processing (message state will change to POSTPONED again and again).

There is new configuration parameter asynch.postponedIntervalWhenFailed that determines interval (in seconds) after that postponed messages will fail.

Comparison to msg-funnel 

Msg-funnel component filters messages in one specific place of the processing but this gauranteed processing order functionality is for wholes routes at the beginning.

There are the following types of message filtering:

How to use it?

Use org.openhubframework.openhub.api.asynch.AsynchRouteBuilder with methods withGuaranteedOrder() or withGuaranteedOrderWithoutFailed() (see Asynchronous messages for more details) or sets AsynchConstants.GUARANTEED_ORDER_HEADER or AsynchConstants.EXCLUDE_FAILED_HEADER to true when you create route definition manually.

private void createRouteForAsyncHelloRouteIn() throws FailedToCreateRouteException { 
	Expression funnelValueExpr = xpath("/h:asyncHelloRequest/h:name").namespaces(ns).stringResult();
    AsynchRouteBuilder.newInstance(ServiceEnum.HELLO, OPERATION_NAME,
            getInWsUri(new QName(SyncHelloRoute.HELLO_SERVICE_NS, "asyncHelloRequest")),
            new AsynchResponseProcessor() {
                protected Object setCallbackResponse(CallbackResponse callbackResponse) {
                    AsyncHelloResponse res = new AsyncHelloResponse();
                    return res;
            }, jaxb(AsyncHelloResponse.class))