You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by Arif Mohd <ar...@wipro.com> on 2007/05/12 18:17:17 UTC

How to set configuration information in xbean.xml dynamically based on message content

Iam using servicemix-http BC i need to pass the authentication information
dynamically i.e, the username and password will contain in the incoming
message itself

 I should be able to pass the authentication info like this in xbean.xml

<basicAuthCredentials>
  <username>${user}</username>
  <password>${password}<password>
</basicAuthCredentials>

where user,password will contain in the incoming message

Is there any possibility of making using of POJO support ?, if it is how to
do that?


-- 
View this message in context: http://www.nabble.com/How-to-set-configuration-information-in-xbean.xml-dynamically-based-on-message-content-tf3732392s12049.html#a10447377
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: How to set configuration information in xbean.xml dynamically based on message content

Posted by Gert Vanthienen <ge...@skynet.be>.
Arif,

One possible solution would be to add a servicemix-lwcontainer SU to your
application and build a simple POJO which adds the properties and then
forwards the message to your topic.  Look at
http://incubator.apache.org/servicemix/pojo-support.html for more
information about how to do it...

Regards,

Gert


Arif Mohd wrote:
> 
> Thank you Gert Vanthienen for quick response,
> 
>     Iam having the similar but another requirement, iam using topic to
> place the messages and the clients will read messages from this topic.
>    Requirement is before placing the message inthe topic i should be able
> to read incoming message information and set some properties of the
> message(Authentication information for the clients) so that the message
> will be read by the intended client
> 
> Please provide some example code this is a very quick requirement tobe
> implemented, a very quick response will be a great help tome.
> 
> Thanks in advance.
> Arif.
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/How-to-set-configuration-information-in-xbean.xml-dynamically-based-on-message-content-tf3732392s12049.html#a10630590
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: How to set configuration information in xbean.xml dynamically based on message content

Posted by Arif Mohd <ar...@wipro.com>.
Thank you Gert Vanthienen for quick response,

    Iam having the similar but another requirement, iam using topic to place
the messages and the clients will read messages from this topic.
   Requirement is before placing the message inthe topic i should be able to
read incoming message information and set some properties of the
message(Authentication information for the clients) so that the message will
be read by the intended client

Please provide some example code this is a very quick requirement tobe
implemented, a very quick response will be a great help tome.

Thanks in advance.
Arif.

Gert Vanthienen wrote:
> 
> L.S.,
> 
> 
> The authentication happens in the
> org.apache.servicemix.http.processors.ProviderProcessor class.  In the
> process() method you will find the basic authentication credentials being
> applied.
> 
> I think you can extend org.apache.servicemix.http.BasicAuthentication to
> support Expression attributes for name and password.  You will probably
> also have to change the applyCredentials() method signature, to add an
> additional parameter -- the message itself -- which you will need to
> resolve the expressions.  You can then reuse <sm:xpath /> to specify the
> expression in your xbean.xml file.  
> 
> I hope this already gets you started.  Just let me know if you need any
> more help...
> 
> I'm a bit confused about your reference to the other forum topic.  Do you
> also want to use this feature?  Doesn't the proposed solution in this
> thread work?
> 
> 
> Regards,
> 
> Gert
> 
> 
> Arif Mohd wrote:
>> 
>> Yes i want this feature, it is very much required i don't know how to
>> proceed could you please provide me some hint where to change the
>> servicemix code and if possible provide me some example code
>> 
>>   Some one in the forum was talking about this feature please have a look
>> into the question 
>> http://www.nabble.com/How-to-add-content-to-SOAP-Header-when-using-http-su-tf3595975s12049.html
>> 
>> This would be a great help to me.
>> 
>> With Warm Regards,
>> Arif
>> 
>> 
>> Gert Vanthienen wrote:
>>> 
>>> L.S.,
>>> 
>>> I don't think ServiceMix currently supports this out-of-the-box.  You
>>> can raise a JIRA issue to suggest this improvement for a next release. 
>>> If you want to add it, just let us know and well try to help you
>>> wherever we can.
>>> 
>>> Regards,
>>> 
>>> Gert
>>> 
>>> 
>>> 
>>> 
>>> Arif Mohd wrote:
>>>> 
>>>> Iam using servicemix-http BC i need to pass the authentication
>>>> information dynamically i.e, the username and password will contain in
>>>> the incoming message itself
>>>> 
>>>>  I should be able to pass the authentication info like this in
>>>> xbean.xml
>>>> 
>>>> <basicAuthCredentials>
>>>>   <username>${user}</username>
>>>>   <password>${password}<password>
>>>> </basicAuthCredentials>
>>>> 
>>>> where user,password will contain in the incoming message
>>>> 
>>>> Is there any possibility of making using of POJO support ?, if it is
>>>> how to do that?
>>>> 
>>>> 
>>>> 
>>> 
>>> 
>> 
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/How-to-set-configuration-information-in-xbean.xml-dynamically-based-on-message-content-tf3732392s12049.html#a10620476
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: changing jms consumer priorities at runtime

Posted by Dominique DE VITO <do...@thalesgroup.com>.
OK.

Many thanks for your quick replies !


Guillaume Nodet a écrit :
> This is my understanding, but you should ask on the ActiveMQ list
> to be sure ...
>
> On 5/14/07, Dominique DE VITO <do...@thalesgroup.com> wrote:
>>
>> I understand your response like this:
>>
>> - it's a priority defining concurrency between possible consumers of the
>> *same* messages,
>> - it's NOT a priority defining (CPU) concurrency between all the
>> consumers (then, my use case could not be implemented)
>>
>> Is it correct ?
>>


Re: changing jms consumer priorities at runtime

Posted by Guillaume Nodet <gn...@gmail.com>.
This is my understanding, but you should ask on the ActiveMQ list
to be sure ...

On 5/14/07, Dominique DE VITO <do...@thalesgroup.com> wrote:
>
> I understand your response like this:
>
> - it's a priority defining concurrency between possible consumers of the
> *same* messages,
> - it's NOT a priority defining (CPU) concurrency between all the
> consumers (then, my use case could not be implemented)
>
> Is it correct ?
>
>
> Guillaume Nodet wrote :
> > If i understand correctly, the consumer priority is only used when
> > choosing
> > a consumer
> > to dispatch the message to.  It won't affect the priority between
> > messages,
> > which
> > is from what you want if I understand correctly.
> >
> > On 5/14/07, Dominique DE VITO <do...@thalesgroup.com> wrote:
> >>
> >> Yes, the priority can't be changed at runtime in ActieMQ
> >>
> >> But I think it could be done in SMX.
> >>
> >> A "queue" looks like created for *each* StandardConsumerProcessor.poll
> ()
> >> method call:
> >> destination = session.createQueue(
> endpoint.getJmsProviderDestinationName
> >> ());
> >>
> >> While changing "JmsProviderDestinationName" property value, from
> >> "TEST.QUEUE?consumer.prority=10" string value to
> >> "TEST.QUEUE?consumer.prority=20" string value, the consumer's priority
> >> might be changed, I think, inside SMX.
> >>
> >> Does it make sense ?
> >>
> >> Here is the use case:
> >> - my own business flows are from/to JMS endpoints, with various
> >> intermediate steps,
> >> - I want to modify flow priorities at business level
> >> - the simplest way I have found is to modify JMS consumer priority to
> >> change the associated business flow priority.
> >>
> >> Dominique
> >>
> >>
> >> Guillaume Nodet a écrit :
> >> > I don't think the priority can be changed at runtime in ActieMQ.
> >> > This will need to close and recreate a new consumer, i.e. stop /
> >> restart
> >> > the endpoint / SU / SA ...
> >> > Another problem is that this is an ActiveMQ specific property ...
> >> >
> >> > What's your use case for changing the consumer prioirity (and not the
> >> > message priority) at runtime ?
> >> >
> >> > On 5/14/07, Dominique DE VITO <do...@thalesgroup.com>
> >> wrote:
> >> >>
> >> >> I have some questions about defining/changing a JMS consumer's
> >> priority
> >> >> inside ServiceMix.
> >> >>
> >> >> * Priority defined at startup time
> >> >>
> >> >> Possible through http://activemq.apache.org/consumer-priority.html ?
> >> >> Is it correct ?
> >> >>
> >> >> * Priority defined dynamically
> >> >>
> >> >> It is not possible to change JMS consumer's priority at runtime
> >> inside
> >> >> SMX.
> >> >> Is it correct ?
> >> >>
> >> >> What about the following solution: exposing a "priority" field
> inside
> >> >> JmsConfigurationMBean class and using this priority when creating a
> >> >> MessageConsumer ?
> >> >>
> >> >> Thanks.
> >> >>
> >> >> Dominique
> >> >>
> >> >>
> >> >
> >> >
> >>
> >>
> >
> >
>
>


-- 
Cheers,
Guillaume Nodet
------------------------
Principal Engineer, IONA
Blog: http://gnodet.blogspot.com/

Re: changing jms consumer priorities at runtime

Posted by Dominique DE VITO <do...@thalesgroup.com>.
I understand your response like this:

- it's a priority defining concurrency between possible consumers of the 
*same* messages,
- it's NOT a priority defining (CPU) concurrency between all the 
consumers (then, my use case could not be implemented)

Is it correct ?


Guillaume Nodet wrote :
> If i understand correctly, the consumer priority is only used when 
> choosing
> a consumer
> to dispatch the message to.  It won't affect the priority between 
> messages,
> which
> is from what you want if I understand correctly.
>
> On 5/14/07, Dominique DE VITO <do...@thalesgroup.com> wrote:
>>
>> Yes, the priority can't be changed at runtime in ActieMQ
>>
>> But I think it could be done in SMX.
>>
>> A "queue" looks like created for *each* StandardConsumerProcessor.poll()
>> method call:
>> destination = session.createQueue(endpoint.getJmsProviderDestinationName
>> ());
>>
>> While changing "JmsProviderDestinationName" property value, from
>> "TEST.QUEUE?consumer.prority=10" string value to
>> "TEST.QUEUE?consumer.prority=20" string value, the consumer's priority
>> might be changed, I think, inside SMX.
>>
>> Does it make sense ?
>>
>> Here is the use case:
>> - my own business flows are from/to JMS endpoints, with various
>> intermediate steps,
>> - I want to modify flow priorities at business level
>> - the simplest way I have found is to modify JMS consumer priority to
>> change the associated business flow priority.
>>
>> Dominique
>>
>>
>> Guillaume Nodet a écrit :
>> > I don't think the priority can be changed at runtime in ActieMQ.
>> > This will need to close and recreate a new consumer, i.e. stop / 
>> restart
>> > the endpoint / SU / SA ...
>> > Another problem is that this is an ActiveMQ specific property ...
>> >
>> > What's your use case for changing the consumer prioirity (and not the
>> > message priority) at runtime ?
>> >
>> > On 5/14/07, Dominique DE VITO <do...@thalesgroup.com> 
>> wrote:
>> >>
>> >> I have some questions about defining/changing a JMS consumer's 
>> priority
>> >> inside ServiceMix.
>> >>
>> >> * Priority defined at startup time
>> >>
>> >> Possible through http://activemq.apache.org/consumer-priority.html ?
>> >> Is it correct ?
>> >>
>> >> * Priority defined dynamically
>> >>
>> >> It is not possible to change JMS consumer's priority at runtime 
>> inside
>> >> SMX.
>> >> Is it correct ?
>> >>
>> >> What about the following solution: exposing a "priority" field inside
>> >> JmsConfigurationMBean class and using this priority when creating a
>> >> MessageConsumer ?
>> >>
>> >> Thanks.
>> >>
>> >> Dominique
>> >>
>> >>
>> >
>> >
>>
>>
>
>


Re: changing jms consumer priorities at runtime

Posted by Guillaume Nodet <gn...@gmail.com>.
If i understand correctly, the consumer priority is only used when choosing
a consumer
to dispatch the message to.  It won't affect the priority between messages,
which
is from what you want if I understand correctly.

On 5/14/07, Dominique DE VITO <do...@thalesgroup.com> wrote:
>
> Yes, the priority can't be changed at runtime in ActieMQ
>
> But I think it could be done in SMX.
>
> A "queue" looks like created for *each* StandardConsumerProcessor.poll()
> method call:
> destination = session.createQueue(endpoint.getJmsProviderDestinationName
> ());
>
> While changing "JmsProviderDestinationName" property value, from
> "TEST.QUEUE?consumer.prority=10" string value to
> "TEST.QUEUE?consumer.prority=20" string value, the consumer's priority
> might be changed, I think, inside SMX.
>
> Does it make sense ?
>
> Here is the use case:
> - my own business flows are from/to JMS endpoints, with various
> intermediate steps,
> - I want to modify flow priorities at business level
> - the simplest way I have found is to modify JMS consumer priority to
> change the associated business flow priority.
>
> Dominique
>
>
> Guillaume Nodet a écrit :
> > I don't think the priority can be changed at runtime in ActieMQ.
> > This will need to close and recreate a new consumer, i.e. stop / restart
> > the endpoint / SU / SA ...
> > Another problem is that this is an ActiveMQ specific property ...
> >
> > What's your use case for changing the consumer prioirity (and not the
> > message priority) at runtime ?
> >
> > On 5/14/07, Dominique DE VITO <do...@thalesgroup.com> wrote:
> >>
> >> I have some questions about defining/changing a JMS consumer's priority
> >> inside ServiceMix.
> >>
> >> * Priority defined at startup time
> >>
> >> Possible through http://activemq.apache.org/consumer-priority.html ?
> >> Is it correct ?
> >>
> >> * Priority defined dynamically
> >>
> >> It is not possible to change JMS consumer's priority at runtime inside
> >> SMX.
> >> Is it correct ?
> >>
> >> What about the following solution: exposing a "priority" field inside
> >> JmsConfigurationMBean class and using this priority when creating a
> >> MessageConsumer ?
> >>
> >> Thanks.
> >>
> >> Dominique
> >>
> >>
> >
> >
>
>


-- 
Cheers,
Guillaume Nodet
------------------------
Principal Engineer, IONA
Blog: http://gnodet.blogspot.com/

Re: changing jms consumer priorities at runtime

Posted by Dominique DE VITO <do...@thalesgroup.com>.
Yes, the priority can't be changed at runtime in ActieMQ

But I think it could be done in SMX.

A "queue" looks like created for *each* StandardConsumerProcessor.poll() 
method call:
destination = session.createQueue(endpoint.getJmsProviderDestinationName());

While changing "JmsProviderDestinationName" property value, from 
"TEST.QUEUE?consumer.prority=10" string value to 
"TEST.QUEUE?consumer.prority=20" string value, the consumer's priority 
might be changed, I think, inside SMX.

Does it make sense ?

Here is the use case:
- my own business flows are from/to JMS endpoints, with various 
intermediate steps,
- I want to modify flow priorities at business level
- the simplest way I have found is to modify JMS consumer priority to 
change the associated business flow priority.

Dominique


Guillaume Nodet a écrit :
> I don't think the priority can be changed at runtime in ActieMQ.
> This will need to close and recreate a new consumer, i.e. stop / restart
> the endpoint / SU / SA ...
> Another problem is that this is an ActiveMQ specific property ...
>
> What's your use case for changing the consumer prioirity (and not the
> message priority) at runtime ?
>
> On 5/14/07, Dominique DE VITO <do...@thalesgroup.com> wrote:
>>
>> I have some questions about defining/changing a JMS consumer's priority
>> inside ServiceMix.
>>
>> * Priority defined at startup time
>>
>> Possible through http://activemq.apache.org/consumer-priority.html ?
>> Is it correct ?
>>
>> * Priority defined dynamically
>>
>> It is not possible to change JMS consumer's priority at runtime inside
>> SMX.
>> Is it correct ?
>>
>> What about the following solution: exposing a "priority" field inside
>> JmsConfigurationMBean class and using this priority when creating a
>> MessageConsumer ?
>>
>> Thanks.
>>
>> Dominique
>>
>>
>
>


Re: changing jms consumer priorities at runtime

Posted by Guillaume Nodet <gn...@gmail.com>.
I don't think the priority can be changed at runtime in ActiveMQ.
This will need to close and recreate a new consumer, i.e. stop / restart
the endpoint / SU / SA ...
Another problem is that this is an ActiveMQ specific property ...

What's your use case for changing the consumer prioirity (and not the
message priority) at runtime ?

On 5/14/07, Dominique DE VITO <do...@thalesgroup.com> wrote:
>
> I have some questions about defining/changing a JMS consumer's priority
> inside ServiceMix.
>
> * Priority defined at startup time
>
> Possible through http://activemq.apache.org/consumer-priority.html ?
> Is it correct ?
>
> * Priority defined dynamically
>
> It is not possible to change JMS consumer's priority at runtime inside
> SMX.
> Is it correct ?
>
> What about the following solution: exposing a "priority" field inside
> JmsConfigurationMBean class and using this priority when creating a
> MessageConsumer ?
>
> Thanks.
>
> Dominique
>
>


-- 
Cheers,
Guillaume Nodet
------------------------
Principal Engineer, IONA
Blog: http://gnodet.blogspot.com/

changing jms consumer priorities at runtime

Posted by Dominique DE VITO <do...@thalesgroup.com>.
I have some questions about defining/changing a JMS consumer's priority 
inside ServiceMix.

* Priority defined at startup time

Possible through http://activemq.apache.org/consumer-priority.html ?
Is it correct ?

* Priority defined dynamically

It is not possible to change JMS consumer's priority at runtime inside SMX.
Is it correct ?

What about the following solution: exposing a "priority" field inside 
JmsConfigurationMBean class and using this priority when creating a 
MessageConsumer ?

Thanks.

Dominique


Re: How to set configuration information in xbean.xml dynamically based on message content

Posted by Gert Vanthienen <ge...@skynet.be>.
L.S.,


The authentication happens in the
org.apache.servicemix.http.processors.ProviderProcessor class.  In the
process() method you will find the basic authentication credentials being
applied.

I think you can extend org.apache.servicemix.http.BasicAuthentication to
support Expression attributes for name and password.  You will probably also
have to change the applyCredentials() method signature, to add an additional
parameter -- the message itself -- which you will need to resolve the
expressions.  You can then reuse <sm:xpath /> to specify the expression in
your xbean.xml file.  

I hope this already gets you started.  Just let me know if you need any more
help...

I'm a bit confused about your reference to the other forum topic.  Do you
also want to use this feature?  Doesn't the proposed solution in this thread
work?


Regards,

Gert


Arif Mohd wrote:
> 
> Yes i want this feature, it is very much required i don't know how to
> proceed could you please provide me some hint where to change the
> servicemix code and if possible provide me some example code
> 
>   Some one in the forum was talking about this feature please have a look
> into the question 
> http://www.nabble.com/How-to-add-content-to-SOAP-Header-when-using-http-su-tf3595975s12049.html
> 
> This would be a great help to me.
> 
> With Warm Regards,
> Arif
> 
> 
> Gert Vanthienen wrote:
>> 
>> L.S.,
>> 
>> I don't think ServiceMix currently supports this out-of-the-box.  You can
>> raise a JIRA issue to suggest this improvement for a next release.  If
>> you want to add it, just let us know and well try to help you wherever we
>> can.
>> 
>> Regards,
>> 
>> Gert
>> 
>> 
>> 
>> 
>> Arif Mohd wrote:
>>> 
>>> Iam using servicemix-http BC i need to pass the authentication
>>> information dynamically i.e, the username and password will contain in
>>> the incoming message itself
>>> 
>>>  I should be able to pass the authentication info like this in xbean.xml
>>> 
>>> <basicAuthCredentials>
>>>   <username>${user}</username>
>>>   <password>${password}<password>
>>> </basicAuthCredentials>
>>> 
>>> where user,password will contain in the incoming message
>>> 
>>> Is there any possibility of making using of POJO support ?, if it is how
>>> to do that?
>>> 
>>> 
>>> 
>> 
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/How-to-set-configuration-information-in-xbean.xml-dynamically-based-on-message-content-tf3732392s12049.html#a10601972
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: How to set configuration information in xbean.xml dynamically based on message content

Posted by Arif Mohd <ar...@wipro.com>.
Yes i want this feature, it is very much required i don't know how to proceed
could you please provide me some hint where to change the servicemix code
and if possible provide me some example code

  Some one in the forum was talking about this feature please have a look
into the question 
http://www.nabble.com/How-to-add-content-to-SOAP-Header-when-using-http-su-tf3595975s12049.html

This would be a great help to me.

With Warm Regards,
Arif


Gert Vanthienen wrote:
> 
> L.S.,
> 
> I don't think ServiceMix currently supports this out-of-the-box.  You can
> raise a JIRA issue to suggest this improvement for a next release.  If you
> want to add it, just let us know and well try to help you wherever we can.
> 
> Regards,
> 
> Gert
> 
> 
> 
> 
> Arif Mohd wrote:
>> 
>> Iam using servicemix-http BC i need to pass the authentication
>> information dynamically i.e, the username and password will contain in
>> the incoming message itself
>> 
>>  I should be able to pass the authentication info like this in xbean.xml
>> 
>> <basicAuthCredentials>
>>   <username>${user}</username>
>>   <password>${password}<password>
>> </basicAuthCredentials>
>> 
>> where user,password will contain in the incoming message
>> 
>> Is there any possibility of making using of POJO support ?, if it is how
>> to do that?
>> 
>> 
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/How-to-set-configuration-information-in-xbean.xml-dynamically-based-on-message-content-tf3732392s12049.html#a10541177
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: How to set configuration information in xbean.xml dynamically based on message content

Posted by Gert Vanthienen <ge...@skynet.be>.
L.S.,

I don't think ServiceMix currently supports this out-of-the-box.  You can
raise a JIRA issue to suggest this improvement for a next release.  If you
want to add it, just let us know and well try to help you wherever we can.

Regards,

Gert




Arif Mohd wrote:
> 
> Iam using servicemix-http BC i need to pass the authentication information
> dynamically i.e, the username and password will contain in the incoming
> message itself
> 
>  I should be able to pass the authentication info like this in xbean.xml
> 
> <basicAuthCredentials>
>   <username>${user}</username>
>   <password>${password}<password>
> </basicAuthCredentials>
> 
> where user,password will contain in the incoming message
> 
> Is there any possibility of making using of POJO support ?, if it is how
> to do that?
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/How-to-set-configuration-information-in-xbean.xml-dynamically-based-on-message-content-tf3732392s12049.html#a10458364
Sent from the ServiceMix - User mailing list archive at Nabble.com.