Mina consuming endpoint with sync - how to override?

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Mina consuming endpoint with sync - how to override?

huntc
Hi there,

I have a consuming mina: endpoint with sync=true set on it. In my use case I have some messages coming in that require a response, and some that do not. Unfortunately where I do not want to return a message Camel is still expecting that I should and throws an ExchangeTimedOutException. How can I tell Camel that despite stating sync=true, for a given exchange it should not expect a response?

I have tried a few things including the invocation of a Processor that closes the Mina session after the InOnly endpoint (exchange.getSession().close()).

Here's my route currently:

from(
    "mina:tcp://0.0.0.0:11010?codec=ilvCodecFactory&lazySessionCreation=true&sync=true")
    .choice().when(body().isNotNull()).to(
        "direct:logFingerprintEvent").otherwise()
    .throwFault(
        "Unknown notification sent by fingerprint reader");

from("direct:logFingerprintEvent")
    .choice()
    .when(body().isInstanceOf(ControlOKEvent.class))
    .to(
        "activemq-sender:queue:...?exchangePattern=InOut")
    .when(body().isInstanceOf(ControlFailedEvent.class))
    .to(
        "activemq-sender:queue:...?exchangePattern=InOnly")
    .otherwise()
    .throwFault(
        "Unhandled notification sent by fingerprint reader");

Thanks for any help.

Kind regards,
Christopher