You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by LeviStrauss <st...@gmail.com> on 2013/07/01 13:04:19 UTC

Jetty asynchronous processing with seda

Hi,

I would like to create a kind of proxy which receives the requests, sends
it to a seda process and waits for the response. How can I send custom
error code back?
This doesn't work with camel 2.4, I always get 200 OK when file shows up in
dir within 30 seconds, if not then I get 500 Server Error not 520.

How can I pass the request (body) to seda process?
I would like to push HTTP request(xml) to a ActiveMQ queue and based on the
returned file content (xpath evaluation) return a code and body to jetty.
(200,500 whatever)

    <route id="seda">
    <from uri="jetty:http://localhost:8088/sedatest"/>
    <to uri="seda:input"/>
    </route>

    <route id="seda2">
    <from uri="seda:input"/>
    <setHeader
headerName="HttpProducer.HTTP_RESPONSE_CODE"><constant>520</constant></setHeader>
    <pollEnrich uri="file:///tmp/seda" timeout="50000"/>

    </route>

Thanks,

Levente

Re: Jetty asynchronous processing with seda

Posted by Willem jiang <wi...@gmail.com>.
pollEnrich doesn't use any data of the current exchange, which means the setHeader doesn't take effect on pollEnrich.

I think you should check the message body, if it is null then set the message header with the response code you want.  

--  
Willem Jiang

Red Hat, Inc.
FuseSource is now part of Red Hat
Web: http://www.fusesource.com | http://www.redhat.com
Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/) (English)
          http://jnn.iteye.com (http://jnn.javaeye.com/) (Chinese)
Twitter: willemjiang  
Weibo: 姜宁willem





On Monday, July 1, 2013 at 7:04 PM, LeviStrauss wrote:

> Hi,
>  
> I would like to create a kind of proxy which receives the requests, sends
> it to a seda process and waits for the response. How can I send custom
> error code back?
> This doesn't work with camel 2.4, I always get 200 OK when file shows up in
> dir within 30 seconds, if not then I get 500 Server Error not 520.
>  
> How can I pass the request (body) to seda process?
> I would like to push HTTP request(xml) to a ActiveMQ queue and based on the
> returned file content (xpath evaluation) return a code and body to jetty.
> (200,500 whatever)
>  
> <route id="seda">
> <from uri="jetty:http://localhost:8088/sedatest"/>
> <to uri="seda:input"/>
> </route>
>  
> <route id="seda2">
> <from uri="seda:input"/>
> <setHeader
> headerName="HttpProducer.HTTP_RESPONSE_CODE"><constant>520</constant></setHeader>
> <pollEnrich uri="file:///tmp/seda" timeout="50000"/>
>  
> </route>
>  
> Thanks,
>  
> Levente