You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by huntc <hu...@mac.com> on 2009/02/05 05:17:23 UTC

Mina consuming endpoint with sync - how to override?

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&amp;lazySessionCreation=true&amp;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


-- 
View this message in context: http://www.nabble.com/Mina-consuming-endpoint-with-sync---how-to-override--tp21845069s22882p21845069.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Mina consuming endpoint with sync - how to override?

Posted by Claus Ibsen <cl...@gmail.com>.
Chris

I added an unit test to the camel-mina component in trunk.
You can see it online from the source link on the camel site.

It uses a camel mina producer to start the test, so that is why its a
try .. catch in that test with the null body.
There is another unit test using plain java socket for starting the
test. You can combine these two and you should have
what you need with skipping responses for some exchanges.



On Thu, Feb 5, 2009 at 8:33 AM, Claus Ibsen <cl...@gmail.com> wrote:
> Hi
>
> What version of Camel are you using?
>
> Does it not help just setting the body to null? The code in trunk will
> not write anything back, but just close the session.
> And log a WARN.
>
>
>
> On Thu, Feb 5, 2009 at 5:17 AM, huntc <hu...@mac.com> wrote:
>>
>> 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&amp;lazySessionCreation=true&amp;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
>>
>>
>> --
>> View this message in context: http://www.nabble.com/Mina-consuming-endpoint-with-sync---how-to-override--tp21845069s22882p21845069.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>
>
>
>
> --
> Claus Ibsen
> Apache Camel Committer
>
> Open Source Integration: http://fusesource.com
> Blog: http://davsclaus.blogspot.com/
>



-- 
Claus Ibsen
Apache Camel Committer

Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/

Re: Mina consuming endpoint with sync - how to override?

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

What version of Camel are you using?

Does it not help just setting the body to null? The code in trunk will
not write anything back, but just close the session.
And log a WARN.



On Thu, Feb 5, 2009 at 5:17 AM, huntc <hu...@mac.com> wrote:
>
> 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&amp;lazySessionCreation=true&amp;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
>
>
> --
> View this message in context: http://www.nabble.com/Mina-consuming-endpoint-with-sync---how-to-override--tp21845069s22882p21845069.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



-- 
Claus Ibsen
Apache Camel Committer

Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/