You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by liugang594 Liu <cl...@gmail.com> on 2013/09/06 06:18:41 UTC

Set CxfEndpoint Property Dynamicly

Hi All:

I'd like to know how can I set the properties of CxfEndpoint dynamicly, for
example use simple expression to calculate and set the property value
during running.

Thanks alot


Thanks
GangLiu
Mail: clevers594@gmail.com

Re: Set CxfEndpoint Property Dynamicly

Posted by liugang594 Liu <cl...@gmail.com>.
Hi Williem:

Thanks. and also I have some other problems when I turned to use customized
CxfBinding, you can find that from my another email:
"CxfProducer cache problem on Camel"

Thanks.



2013/9/10 Willem jiang <wi...@gmail.com>

> The CxfEndpoint Property is set at the design time, if you want to change
> the CXF endpoint behavior at the Runtime you may need to consider to set
> the message header just like this.
>
> Map<String, Object> requestContext = new HashMap<String, Object>();
> requestContext.put(Message.ENDPOINT_ADDRESS, getSimpleServerAddress());
> exchange.getIn().setBody(params);
> exchange.getIn().setHeader(Client.REQUEST_CONTEXT , requestContext);
>
>
> --
> Willem Jiang
>
> Red Hat, Inc.
> Web: 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 Tuesday, September 10, 2013 at 9:20 AM, liugang594 Liu wrote:
>
> > Yap, seems not possible for now, it's great if we can support it somehow
> in
> > future.
> >
> > Anyway, Thanks alot.
> >
> >
> > 2013/9/9 Claus Ibsen <claus.ibsen@gmail.com (mailto:
> claus.ibsen@gmail.com)>
> >
> > > Hi
> > >
> > > You cannot do this from the Camel route DSL. You can however use a
> > > java bean / Camel processor and do java code to do whatever you want.
> > >
> > > Though not sure if changing CXF properties at runtime is supported in
> > > camel-cxf. Though you can give it a try to see what happens.
> > >
> > > On Fri, Sep 6, 2013 at 11:37 AM, liugang594 Liu <clevers594@gmail.com(mailto:
> clevers594@gmail.com)>
> > > wrote:
> > > > for example, if I have some route like:
> > > >
> > > > *from(uri) **[Step1]* *.setHeader(name, value) **[Step2]* *.to(cxf)
> **
> > > > [Step3]*...
> > > >
> > > > I want to specify some cxf property *[step3]* as the value specified
> in
> > > > setHeader Component *[step2]*.
> > > >
> > > > same as we do something by code :
> > > >
> > > > cxfEndpoint.getProperties().put("propertyName", header(headerName));
> > > >
> > > > no only header, but also some other expression:
> > > >
> > > > cxfEndpoint.getProperties().put("propertyName",
> > > > simple(expression).evaluate(exchange, String.class));
> > > >
> > > >
> > > > 2013/9/6 Claus Ibsen <claus.ibsen@gmail.com (mailto:
> claus.ibsen@gmail.com)>
> > > >
> > > > > Hi
> > > > >
> > > > > What do you mean can you explain in more details?
> > > > >
> > > > >
> > > > > On Fri, Sep 6, 2013 at 6:18 AM, liugang594 Liu <
> clevers594@gmail.com (mailto:clevers594@gmail.com)>
> > > > > wrote:
> > > > > > Hi All:
> > > > > >
> > > > > > I'd like to know how can I set the properties of CxfEndpoint
> > > dynamicly,
> > > > > for
> > > > > > example use simple expression to calculate and set the property
> value
> > > > > > during running.
> > > > > >
> > > > > > Thanks alot
> > > > > >
> > > > > >
> > > > > > Thanks
> > > > > > GangLiu
> > > > > > Mail: clevers594@gmail.com (mailto:clevers594@gmail.com)
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > --
> > > > > Claus Ibsen
> > > > > -----------------
> > > > > Red Hat, Inc.
> > > > > Email: cibsen@redhat.com (mailto:cibsen@redhat.com)
> > > > > Twitter: davsclaus
> > > > > Blog: http://davsclaus.com
> > > > > Author of Camel in Action: http://www.manning.com/ibsen
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > --
> > > > Thanks
> > > > GangLiu
> > > > Mail: clevers594@gmail.com (mailto:clevers594@gmail.com)
> > >
> > >
> > >
> > >
> > >
> > > --
> > > Claus Ibsen
> > > -----------------
> > > Red Hat, Inc.
> > > Email: cibsen@redhat.com (mailto:cibsen@redhat.com)
> > > Twitter: davsclaus
> > > Blog: http://davsclaus.com
> > > Author of Camel in Action: http://www.manning.com/ibsen
> >
> >
> >
> >
> >
> > --
> > Thanks
> > GangLiu
> > Mail: clevers594@gmail.com (mailto:clevers594@gmail.com)
>
>
>
>


-- 
Thanks
GangLiu
Mail: clevers594@gmail.com

Re: Set CxfEndpoint Property Dynamicly

Posted by Willem jiang <wi...@gmail.com>.
The CxfEndpoint Property is set at the design time, if you want to change the CXF endpoint behavior at the Runtime you may need to consider to set the message header just like this.

Map<String, Object> requestContext = new HashMap<String, Object>();  
requestContext.put(Message.ENDPOINT_ADDRESS, getSimpleServerAddress());
exchange.getIn().setBody(params);
exchange.getIn().setHeader(Client.REQUEST_CONTEXT , requestContext);


--  
Willem Jiang

Red Hat, Inc.
Web: 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 Tuesday, September 10, 2013 at 9:20 AM, liugang594 Liu wrote:

> Yap, seems not possible for now, it's great if we can support it somehow in
> future.
>  
> Anyway, Thanks alot.
>  
>  
> 2013/9/9 Claus Ibsen <claus.ibsen@gmail.com (mailto:claus.ibsen@gmail.com)>
>  
> > Hi
> >  
> > You cannot do this from the Camel route DSL. You can however use a
> > java bean / Camel processor and do java code to do whatever you want.
> >  
> > Though not sure if changing CXF properties at runtime is supported in
> > camel-cxf. Though you can give it a try to see what happens.
> >  
> > On Fri, Sep 6, 2013 at 11:37 AM, liugang594 Liu <clevers594@gmail.com (mailto:clevers594@gmail.com)>
> > wrote:
> > > for example, if I have some route like:
> > >  
> > > *from(uri) **[Step1]* *.setHeader(name, value) **[Step2]* *.to(cxf) **
> > > [Step3]*...
> > >  
> > > I want to specify some cxf property *[step3]* as the value specified in
> > > setHeader Component *[step2]*.
> > >  
> > > same as we do something by code :
> > >  
> > > cxfEndpoint.getProperties().put("propertyName", header(headerName));
> > >  
> > > no only header, but also some other expression:
> > >  
> > > cxfEndpoint.getProperties().put("propertyName",
> > > simple(expression).evaluate(exchange, String.class));
> > >  
> > >  
> > > 2013/9/6 Claus Ibsen <claus.ibsen@gmail.com (mailto:claus.ibsen@gmail.com)>
> > >  
> > > > Hi
> > > >  
> > > > What do you mean can you explain in more details?
> > > >  
> > > >  
> > > > On Fri, Sep 6, 2013 at 6:18 AM, liugang594 Liu <clevers594@gmail.com (mailto:clevers594@gmail.com)>
> > > > wrote:
> > > > > Hi All:
> > > > >  
> > > > > I'd like to know how can I set the properties of CxfEndpoint
> > dynamicly,
> > > > for
> > > > > example use simple expression to calculate and set the property value
> > > > > during running.
> > > > >  
> > > > > Thanks alot
> > > > >  
> > > > >  
> > > > > Thanks
> > > > > GangLiu
> > > > > Mail: clevers594@gmail.com (mailto:clevers594@gmail.com)
> > > >  
> > > >  
> > > >  
> > > >  
> > > >  
> > > > --
> > > > Claus Ibsen
> > > > -----------------
> > > > Red Hat, Inc.
> > > > Email: cibsen@redhat.com (mailto:cibsen@redhat.com)
> > > > Twitter: davsclaus
> > > > Blog: http://davsclaus.com
> > > > Author of Camel in Action: http://www.manning.com/ibsen
> > >  
> > >  
> > >  
> > >  
> > >  
> > > --
> > > Thanks
> > > GangLiu
> > > Mail: clevers594@gmail.com (mailto:clevers594@gmail.com)
> >  
> >  
> >  
> >  
> >  
> > --
> > Claus Ibsen
> > -----------------
> > Red Hat, Inc.
> > Email: cibsen@redhat.com (mailto:cibsen@redhat.com)
> > Twitter: davsclaus
> > Blog: http://davsclaus.com
> > Author of Camel in Action: http://www.manning.com/ibsen
>  
>  
>  
>  
>  
> --  
> Thanks
> GangLiu
> Mail: clevers594@gmail.com (mailto:clevers594@gmail.com)




Re: Set CxfEndpoint Property Dynamicly

Posted by liugang594 Liu <cl...@gmail.com>.
Yap, seems not possible for now, it's great if we can support it somehow in
future.

Anyway, Thanks alot.


2013/9/9 Claus Ibsen <cl...@gmail.com>

> Hi
>
> You cannot do this from the Camel route DSL. You can however use a
> java bean / Camel processor and do java code to do whatever you want.
>
> Though not sure if changing CXF properties at runtime is supported in
> camel-cxf. Though you can give it a try to see what happens.
>
> On Fri, Sep 6, 2013 at 11:37 AM, liugang594 Liu <cl...@gmail.com>
> wrote:
> > for example, if I have some route like:
> >
> > *from(uri) **[Step1]* *.setHeader(name, value) **[Step2]* *.to(cxf) **
> > [Step3]*...
> >
> > I want to specify some cxf property *[step3]* as the value specified in
> > setHeader Component *[step2]*.
> >
> > same as we do something by code :
> >
> > cxfEndpoint.getProperties().put("propertyName", header(headerName));
> >
> > no only header, but also some other expression:
> >
> > cxfEndpoint.getProperties().put("propertyName",
> > simple(expression).evaluate(exchange, String.class));
> >
> >
> > 2013/9/6 Claus Ibsen <cl...@gmail.com>
> >
> >> Hi
> >>
> >> What do you mean can you explain in more details?
> >>
> >>
> >> On Fri, Sep 6, 2013 at 6:18 AM, liugang594 Liu <cl...@gmail.com>
> >> wrote:
> >> > Hi All:
> >> >
> >> > I'd like to know how can I set the properties of CxfEndpoint
> dynamicly,
> >> for
> >> > example use simple expression to calculate and set the property value
> >> > during running.
> >> >
> >> > Thanks alot
> >> >
> >> >
> >> > Thanks
> >> > GangLiu
> >> > Mail: clevers594@gmail.com
> >>
> >>
> >>
> >> --
> >> Claus Ibsen
> >> -----------------
> >> Red Hat, Inc.
> >> Email: cibsen@redhat.com
> >> Twitter: davsclaus
> >> Blog: http://davsclaus.com
> >> Author of Camel in Action: http://www.manning.com/ibsen
> >>
> >
> >
> >
> > --
> > Thanks
> > GangLiu
> > Mail: clevers594@gmail.com
>
>
>
> --
> Claus Ibsen
> -----------------
> Red Hat, Inc.
> Email: cibsen@redhat.com
> Twitter: davsclaus
> Blog: http://davsclaus.com
> Author of Camel in Action: http://www.manning.com/ibsen
>



-- 
Thanks
GangLiu
Mail: clevers594@gmail.com

Re: Set CxfEndpoint Property Dynamicly

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

You cannot do this from the Camel route DSL. You can however use a
java bean / Camel processor and do java code to do whatever you want.

Though not sure if changing CXF properties at runtime is supported in
camel-cxf. Though you can give it a try to see what happens.

On Fri, Sep 6, 2013 at 11:37 AM, liugang594 Liu <cl...@gmail.com> wrote:
> for example, if I have some route like:
>
> *from(uri) **[Step1]* *.setHeader(name, value) **[Step2]* *.to(cxf) **
> [Step3]*...
>
> I want to specify some cxf property *[step3]* as the value specified in
> setHeader Component *[step2]*.
>
> same as we do something by code :
>
> cxfEndpoint.getProperties().put("propertyName", header(headerName));
>
> no only header, but also some other expression:
>
> cxfEndpoint.getProperties().put("propertyName",
> simple(expression).evaluate(exchange, String.class));
>
>
> 2013/9/6 Claus Ibsen <cl...@gmail.com>
>
>> Hi
>>
>> What do you mean can you explain in more details?
>>
>>
>> On Fri, Sep 6, 2013 at 6:18 AM, liugang594 Liu <cl...@gmail.com>
>> wrote:
>> > Hi All:
>> >
>> > I'd like to know how can I set the properties of CxfEndpoint dynamicly,
>> for
>> > example use simple expression to calculate and set the property value
>> > during running.
>> >
>> > Thanks alot
>> >
>> >
>> > Thanks
>> > GangLiu
>> > Mail: clevers594@gmail.com
>>
>>
>>
>> --
>> Claus Ibsen
>> -----------------
>> Red Hat, Inc.
>> Email: cibsen@redhat.com
>> Twitter: davsclaus
>> Blog: http://davsclaus.com
>> Author of Camel in Action: http://www.manning.com/ibsen
>>
>
>
>
> --
> Thanks
> GangLiu
> Mail: clevers594@gmail.com



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen

Re: Set CxfEndpoint Property Dynamicly

Posted by liugang594 Liu <cl...@gmail.com>.
for example, if I have some route like:

*from(uri) **[Step1]* *.setHeader(name, value) **[Step2]* *.to(cxf) **
[Step3]*...

I want to specify some cxf property *[step3]* as the value specified in
setHeader Component *[step2]*.

same as we do something by code :

cxfEndpoint.getProperties().put("propertyName", header(headerName));

no only header, but also some other expression:

cxfEndpoint.getProperties().put("propertyName",
simple(expression).evaluate(exchange, String.class));


2013/9/6 Claus Ibsen <cl...@gmail.com>

> Hi
>
> What do you mean can you explain in more details?
>
>
> On Fri, Sep 6, 2013 at 6:18 AM, liugang594 Liu <cl...@gmail.com>
> wrote:
> > Hi All:
> >
> > I'd like to know how can I set the properties of CxfEndpoint dynamicly,
> for
> > example use simple expression to calculate and set the property value
> > during running.
> >
> > Thanks alot
> >
> >
> > Thanks
> > GangLiu
> > Mail: clevers594@gmail.com
>
>
>
> --
> Claus Ibsen
> -----------------
> Red Hat, Inc.
> Email: cibsen@redhat.com
> Twitter: davsclaus
> Blog: http://davsclaus.com
> Author of Camel in Action: http://www.manning.com/ibsen
>



-- 
Thanks
GangLiu
Mail: clevers594@gmail.com

Re: Set CxfEndpoint Property Dynamicly

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

What do you mean can you explain in more details?


On Fri, Sep 6, 2013 at 6:18 AM, liugang594 Liu <cl...@gmail.com> wrote:
> Hi All:
>
> I'd like to know how can I set the properties of CxfEndpoint dynamicly, for
> example use simple expression to calculate and set the property value
> during running.
>
> Thanks alot
>
>
> Thanks
> GangLiu
> Mail: clevers594@gmail.com



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen