camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Willem Jiang <willem.ji...@gmail.com>
Subject Re: What to do with HTTP response when route from HTTP to JMS?
Date Fri, 14 Aug 2009 01:38:54 GMT
Hi,

If camel can't send the JMS message into the jms queue, it will throw 
the exception , and camel will use the default error handler[1] (which 
will try to redeliver the message few times) to deal with this error, 
then the jetty consumer can get the error and send back an error message 
to the client.
So If you just want to send the OK message back to the jetty endpoint, 
you may need to the work like this
from("jetty:http://localhost:9080/myapp/myservice")
   .process(new Processor() {...})
    // set the exchange pattern, since there is no response from jms queue
   .inOnly()
   .to("jms:queue:some_queue")
   // set the out message for jetty consumer to send back to client
   .inOut().setBody(constant("OK"));

[1]http://camel.apache.org/error-handler.html

Willem

janylj wrote:
> I don't think it works. My exact route is:
> 
> from("jetty:http://localhost:9080/myapp/myservice")
> .process(new Processor() {...})
> .to("jms:queue:some_queue")
> .to("http://localhost:9080/myapp/myservice");
> 
> I still got the error said,
> org.apache.camel.ExchangeTimedOutException: The OUT message was not received
> within: 20000 millis on the exchange:
> 
> Basically I would like my starting endpoint receive 200 status ok when send
> jms successfully or 500 error when send jms failed. How to do that?
> 
> Thanks a lot.
> 
> 
> Claus Ibsen-2 wrote:
>> On Wed, Aug 12, 2009 at 7:01 PM, janylj<janylj@gmail.com> wrote:
>>> Thanks a lot, Willem. It works using inOnly()
>>>
>>> willem.jiang wrote:
>>>> from("jetty ....").process(...).inOnly().to("jms:queue")
>>>>
>>> How to make it send a HttpResponse only if sending JMS message is
>>> successfully. I tried to list the same jetty endpoint in the end, but it
>>> doesn't work. Please advise. Thanks again.
>>>
>>> from("jetty ....").process(...).to("jms:queue").to("jetty....")
>>>
>> jetty is only used as a consumer, eg you can only use it in the from node.
>> So when you want to call some external HTTP service use the http
>> component instead
>>
>> from(jetty).to(http)  = OK
>>
>> from(jetty).to(jetty) = NO OK
>>
>>
>>> --
>>> View this message in context:
>>> http://www.nabble.com/What-to-do-with-HTTP-response-when-route-from-HTTP-to-JMS--tp24924548p24940755.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/
>> Twitter: http://twitter.com/davsclaus
>>
>>
> 


Mime
View raw message