You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Wang Yan <wy...@gmail.com> on 2019/11/16 11:55:00 UTC

component options setting vs exchange 's in /out header setting

For some component, I could set key and value at the exchange's in or out's
header instead of
using the component's option at the endpoint .

For me, it is not very clearly documented, which options could be set at
in/out /header

set option at endpoint URI

from(xxx) .inOut().to("activemq:queue:foo?replyTo=bar&receiveTimeout=250")
.to(yyy)

could I set value in the header like below way to
achieve the same effect?

from(xxx) .inOut()
.setHeader("replyTo", constant("bar"))
.setHeader("receiveTimeout", new Integer("250"))
.to("activemq:queue:foo) .to(yyy)

I hope I explain my meaning clearly enough, any suggestion or feedback is
more than welcome!

Re: component options setting vs exchange 's in /out header setting

Posted by Gmail <we...@gmail.com>.
To make it simple to use, if the options provided, the used in URL. If not, then you can use it in headers 

Sent from Weiquan

> On Nov 16, 2019, at 6:59 AM, Claus Ibsen <cl...@gmail.com> wrote:
> 
> Hi
> 
> No you cannot set component or endpoint options as headers. Only a
> limited number of headers can control the endpoints, and they are
> documented in the components that support this.
> 
> Once aspect which we don't have but which would have been great, was
> that these headers was also marked up with annotations so they could
> be enlisted automatic in the documentation and known for 3rd party
> tooling.
> 
> The activemq/jms component understands the JMS headers, which can
> control some aspects. See their documentation.
> 
> if you want dynamic to based on header values, then see the toD EIP pattern
> 
>> On Sat, Nov 16, 2019 at 12:55 PM Wang Yan <wy...@gmail.com> wrote:
>> 
>> For some component, I could set key and value at the exchange's in or out's
>> header instead of
>> using the component's option at the endpoint .
>> 
>> For me, it is not very clearly documented, which options could be set at
>> in/out /header
>> 
>> set option at endpoint URI
>> 
>> from(xxx) .inOut().to("activemq:queue:foo?replyTo=bar&receiveTimeout=250")
>> .to(yyy)
>> 
>> could I set value in the header like below way to
>> achieve the same effect?
>> 
>> from(xxx) .inOut()
>> .setHeader("replyTo", constant("bar"))
>> .setHeader("receiveTimeout", new Integer("250"))
>> .to("activemq:queue:foo) .to(yyy)
>> 
>> I hope I explain my meaning clearly enough, any suggestion or feedback is
>> more than welcome!
> 
> 
> 
> -- 
> Claus Ibsen
> -----------------
> http://davsclaus.com @davsclaus
> Camel in Action 2: https://www.manning.com/ibsen2

Re: component options setting vs exchange 's in /out header setting

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

No you cannot set component or endpoint options as headers. Only a
limited number of headers can control the endpoints, and they are
documented in the components that support this.

Once aspect which we don't have but which would have been great, was
that these headers was also marked up with annotations so they could
be enlisted automatic in the documentation and known for 3rd party
tooling.

The activemq/jms component understands the JMS headers, which can
control some aspects. See their documentation.

if you want dynamic to based on header values, then see the toD EIP pattern

On Sat, Nov 16, 2019 at 12:55 PM Wang Yan <wy...@gmail.com> wrote:
>
> For some component, I could set key and value at the exchange's in or out's
> header instead of
> using the component's option at the endpoint .
>
> For me, it is not very clearly documented, which options could be set at
> in/out /header
>
> set option at endpoint URI
>
> from(xxx) .inOut().to("activemq:queue:foo?replyTo=bar&receiveTimeout=250")
> .to(yyy)
>
> could I set value in the header like below way to
> achieve the same effect?
>
> from(xxx) .inOut()
> .setHeader("replyTo", constant("bar"))
> .setHeader("receiveTimeout", new Integer("250"))
> .to("activemq:queue:foo) .to(yyy)
>
> I hope I explain my meaning clearly enough, any suggestion or feedback is
> more than welcome!



-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2