Hi,

for an explanation about exchange pattern have a look here: http://camel.apache.org/request-reply.html

first of all I would set the exchange pattern as an argument on the to-element cause I think that makes the routes much more readable. Nevertheless I cannot find an error at your implementation. are you sure the HTTP POST method gives back a response? you may explain your problem in more detail.

consider using the tracer to see whats happening in your route.

regards, Marco



Am 15.08.2013 11:14, schrieb Niels:
Hey there,

I've been playing around with the different ExchangePatterns but couldn't
figure out 100% how they work.

I'm assuming that ExchangePatterns are set on a Exchange based level. But
during my investigation on the message headers I couldn't find the property
for the ExchangePattern (I examined the message headers using AMQ Webconsole
so I'm only 99% sure I got so see them all). I can also rule out Route based
level because I examined the routes using JConsole and couldn't find any
reference to ExchangePattern.

Assuming they are set on a Exchange I'm wondering why I can't change the
them in different routes.
I'm trying to do something like this:

<route>
        <from uri="jetty:http://0.0.0.0:9000/test"/>
        <setExchangePattern pattern="InOnly"/>
        <to uri="activemq:in_http_1d3329c4-e516-4ac6-b086-c9d696f21208" />
</route>
<route>
        <from uri="activemq:in_http_1d3329c4-e516-4ac6-b086-c9d696f21208"/>
        <setExchangePattern pattern="InOut"/>
        <setHeader headerName="CamelHttpMethod">
                <constant>POST</constant>
        </setHeader>
        <to uri="https://posttestserver.com/post.php"/>
        <to uri="activemq:in_http_af1f4dea-8299-4132-8640-1fa29234945c"/>
</route>
<route>
        <from uri="activemq:in_http_af1f4dea-8299-4132-8640-1fa29234945c"/>
        <to
uri="file:/tmp/results?autoCreate=true&amp;charset=utf-8&amp;fileExist=Override"/>
</route>

I expose a Jetty http endpoint where people can post to, they don't care
about the response just sending back a 200 is fine here. That's why I use
the In Only exchange pattern works fine.

Now the next route I'm posting to another http service but in contrary to
the first route I want to capture the response and pass it on. Since the
ExchangePattern is set on an Exchange I would assume setting it back to
default InOut would enable me to capture the http response. However that's
not the case!

I'm confused over here, could anybody explain to me if I'm right?
Or could suggest another solution to my problem?

Niels Stevens



--
View this message in context: 
http://camel.465427.n5.nabble.com/ExchangePatterns-tp5737308.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Reply via email to