You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by rgavlin <rg...@yahoo.com> on 2008/04/07 05:52:49 UTC

Calculating service & endpoint from within servicemix-bean.onMessageExchange()

Greetings,

I have a servicemix-bean similar to the example ListenerBean
(http://incubator.apache.org/servicemix/dist/servicemix-3.1-incubating/site/deployables/serviceengines/servicemix-bean/xref-test/org/apache/servicemix/bean/beans/ListenerBean.html).
Within onMessageExchange(), how can I calculate the relevant service &
endpoint values?

Thanks in advance.

- Ron
-- 
View this message in context: http://www.nabble.com/Calculating-service---endpoint-from-within-servicemix-bean.onMessageExchange%28%29-tp16533225p16533225.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: Calculating service & endpoint from within servicemix-bean.onMessageExchange()

Posted by Andrea Zoppello <zo...@tiscali.it>.
Hi Ron,

Just ask this to Guillaume, that point me that this line of code is not 
needed anymore.

Andrea
lhein ha scritto:
> Ron,
>
> I am not sure wether you even need this property or not. I would say it is
> not needed at all.
> If you still want to somehow fill this information I would suggest you to
> put 2 variables in your class:
>
> private QName senderService;
> private String senderEndpoint;
>
> Then adding the public getters and setters for this variables will enable
> you to inject values to this variables by configuring them in the beans
> xbean.xml as properties of the bean.
>
> But I would suggest first left them away and try without this property.
>
> Btw. I am still not sure what this transformer will do exactly. I mean it
> will transform a incoming exchange into another one or filling the out if
> other then InOnly and RobustInOnly. But don't we already have something like
> this? If not then better do a Transformer SE which has a customizable
> Marshaler.
>
> Regards
> Lars
>
>
>
>
> rgavlin wrote:
>   
>> Hi Lars,
>>
>> I am in the process of trying to port the functionality offered by the
>> deprecated lw-container TransformComponentSupport.java base class to a
>> servicemix-bean base class (see JIRA
>> https://issues.apache.org/activemq/browse/SM-1305). The line of code in
>> question is 
>>
>> outExchange.setProperty(JbiConstants.SENDER_ENDPOINT, getService() + ":" +
>> getEndpoint());
>>
>> (see
>> http://www.koders.com/java/fid258A2E5D6391E440CF23016392548C199B5C31BF.aspx#L62)
>>
>> The old lw-container components had a constructor which supplied the
>> service QName and the endpoint name. This is not the case for a
>> servicemix-bean Pojo. Is this information available to the Pojo via the
>> ComponentContext or is it guaranteed to be present somewhere in the
>> MessageExchange parameter supplied to the
>> onMessageExchange(MessageExchange) method? Is there another mechanism to
>> capture this information?
>>
>> Thanks in advance for your assistance.
>>
>> - Ron
>>
>>
>>
>> lhe77 wrote:
>>     
>>> As you have a bean only which implements the listener interface, there
>>> are no properties telling you what's the name of the endpoint / service
>>> of this bean. (at least I do not know any)
>>> Maybe the channel or the component context can tell you something, but I
>>> am wondering why do you need that information. Much more interesting
>>> values are the targetService and targetEndpoint properties. If you want
>>> such things, then create these properties inside your bean as private
>>> variables and put the corresponding getters and setters in the code as
>>> well. Then you should have access to these values from within your code.
>>>
>>> Lars
>>>
>>>
>>>
>>>
>>>
>>> rgavlin schrieb:
>>>       
>>>> Within my code, I want to know the service QName and the endpoint name
>>>> that
>>>> was "configured" for my endpoint. In other words, I want to know the
>>>> information from the xbean.xml file that was used to configure my
>>>> ServiceEndpoint instance. Does that make sense?
>>>>
>>>> - Ron
>>>>
>>>>
>>>> lhe77 wrote:
>>>>   
>>>>         
>>>>> I think you can't "calculate" it. The service or endpoint is a thing of
>>>>> your configuration. What you can do of course is routing a message to a
>>>>> specific service depending on the content of the message.
>>>>> Otherwise you have to set your targetService / targetEndpoint to suit
>>>>> your
>>>>> needs.
>>>>>
>>>>> Regards
>>>>> Lars
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> rgavlin schrieb:
>>>>>     
>>>>>           
>>>>>> Greetings,
>>>>>>
>>>>>> I have a servicemix-bean similar to the example ListenerBean
>>>>>> (http://incubator.apache.org/servicemix/dist/servicemix-3.1-incubating/site/deployables/serviceengines/servicemix-bean/xref-test/org/apache/servicemix/bean/beans/ListenerBean.html).
>>>>>> Within onMessageExchange(), how can I calculate the relevant service &
>>>>>> endpoint values?
>>>>>>
>>>>>> Thanks in advance.
>>>>>>
>>>>>> - Ron
>>>>>>   
>>>>>>       
>>>>>>             
>>>>>     
>>>>>           
>>>>   
>>>>         
>>>       
>>     
>
>   


Re: Calculating service & endpoint from within servicemix-bean.onMessageExchange()

Posted by rgavlin <rg...@yahoo.com>.
The servicemix-bean schema
(http://repo1.maven.org/maven2/org/apache/servicemix/servicemix-bean/3.2/servicemix-bean-3.2-schema.html)
already defines the following properties:

endpoint	xs:string	
interfaceName	xs:QName	
service	xs:QName	

I am simply looking for a supported mechanism for accessing these properties
that get injected into servicemix-bean from my Pojo. I don't want to define
two more properties that duplicate these properties. Can I do this?

- Ron


lhein wrote:
> 
> Ron,
> 
> I am not sure wether you even need this property or not. I would say it is
> not needed at all.
> If you still want to somehow fill this information I would suggest you to
> put 2 variables in your class:
> 
> private QName senderService;
> private String senderEndpoint;
> 
> Then adding the public getters and setters for this variables will enable
> you to inject values to this variables by configuring them in the beans
> xbean.xml as properties of the bean.
> 
> But I would suggest first left them away and try without this property.
> 
> Btw. I am still not sure what this transformer will do exactly. I mean it
> will transform a incoming exchange into another one or filling the out if
> other then InOnly and RobustInOnly. But don't we already have something
> like this? If not then better do a Transformer SE which has a customizable
> Marshaler.
> 
> Regards
> Lars
> 
> 
> 
> 
> rgavlin wrote:
>> 
>> Hi Lars,
>> 
>> I am in the process of trying to port the functionality offered by the
>> deprecated lw-container TransformComponentSupport.java base class to a
>> servicemix-bean base class (see JIRA
>> https://issues.apache.org/activemq/browse/SM-1305). The line of code in
>> question is 
>> 
>> outExchange.setProperty(JbiConstants.SENDER_ENDPOINT, getService() + ":"
>> + getEndpoint());
>> 
>> (see
>> http://www.koders.com/java/fid258A2E5D6391E440CF23016392548C199B5C31BF.aspx#L62)
>> 
>> The old lw-container components had a constructor which supplied the
>> service QName and the endpoint name. This is not the case for a
>> servicemix-bean Pojo. Is this information available to the Pojo via the
>> ComponentContext or is it guaranteed to be present somewhere in the
>> MessageExchange parameter supplied to the
>> onMessageExchange(MessageExchange) method? Is there another mechanism to
>> capture this information?
>> 
>> Thanks in advance for your assistance.
>> 
>> - Ron
>> 
>> 
>> 
>> lhe77 wrote:
>>> 
>>> As you have a bean only which implements the listener interface, there
>>> are no properties telling you what's the name of the endpoint / service
>>> of this bean. (at least I do not know any)
>>> Maybe the channel or the component context can tell you something, but I
>>> am wondering why do you need that information. Much more interesting
>>> values are the targetService and targetEndpoint properties. If you want
>>> such things, then create these properties inside your bean as private
>>> variables and put the corresponding getters and setters in the code as
>>> well. Then you should have access to these values from within your code.
>>> 
>>> Lars
>>> 
>>> 
>>> 
>>> 
>>> 
>>> rgavlin schrieb:
>>>> Within my code, I want to know the service QName and the endpoint name
>>>> that
>>>> was "configured" for my endpoint. In other words, I want to know the
>>>> information from the xbean.xml file that was used to configure my
>>>> ServiceEndpoint instance. Does that make sense?
>>>>
>>>> - Ron
>>>>
>>>>
>>>> lhe77 wrote:
>>>>   
>>>>> I think you can't "calculate" it. The service or endpoint is a thing
>>>>> of
>>>>> your configuration. What you can do of course is routing a message to
>>>>> a
>>>>> specific service depending on the content of the message.
>>>>> Otherwise you have to set your targetService / targetEndpoint to suit
>>>>> your
>>>>> needs.
>>>>>
>>>>> Regards
>>>>> Lars
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> rgavlin schrieb:
>>>>>     
>>>>>> Greetings,
>>>>>>
>>>>>> I have a servicemix-bean similar to the example ListenerBean
>>>>>> (http://incubator.apache.org/servicemix/dist/servicemix-3.1-incubating/site/deployables/serviceengines/servicemix-bean/xref-test/org/apache/servicemix/bean/beans/ListenerBean.html).
>>>>>> Within onMessageExchange(), how can I calculate the relevant service
>>>>>> &
>>>>>> endpoint values?
>>>>>>
>>>>>> Thanks in advance.
>>>>>>
>>>>>> - Ron
>>>>>>   
>>>>>>       
>>>>>     
>>>>
>>>>   
>>> 
>>> 
>> 
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Calculating-service---endpoint-from-within-servicemix-bean.onMessageExchange%28%29-tp16533225p16543394.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: Calculating service & endpoint from within servicemix-bean.onMessageExchange()

Posted by lhein <lh...@apache.org>.
Ron,

I am not sure wether you even need this property or not. I would say it is
not needed at all.
If you still want to somehow fill this information I would suggest you to
put 2 variables in your class:

private QName senderService;
private String senderEndpoint;

Then adding the public getters and setters for this variables will enable
you to inject values to this variables by configuring them in the beans
xbean.xml as properties of the bean.

But I would suggest first left them away and try without this property.

Btw. I am still not sure what this transformer will do exactly. I mean it
will transform a incoming exchange into another one or filling the out if
other then InOnly and RobustInOnly. But don't we already have something like
this? If not then better do a Transformer SE which has a customizable
Marshaler.

Regards
Lars




rgavlin wrote:
> 
> Hi Lars,
> 
> I am in the process of trying to port the functionality offered by the
> deprecated lw-container TransformComponentSupport.java base class to a
> servicemix-bean base class (see JIRA
> https://issues.apache.org/activemq/browse/SM-1305). The line of code in
> question is 
> 
> outExchange.setProperty(JbiConstants.SENDER_ENDPOINT, getService() + ":" +
> getEndpoint());
> 
> (see
> http://www.koders.com/java/fid258A2E5D6391E440CF23016392548C199B5C31BF.aspx#L62)
> 
> The old lw-container components had a constructor which supplied the
> service QName and the endpoint name. This is not the case for a
> servicemix-bean Pojo. Is this information available to the Pojo via the
> ComponentContext or is it guaranteed to be present somewhere in the
> MessageExchange parameter supplied to the
> onMessageExchange(MessageExchange) method? Is there another mechanism to
> capture this information?
> 
> Thanks in advance for your assistance.
> 
> - Ron
> 
> 
> 
> lhe77 wrote:
>> 
>> As you have a bean only which implements the listener interface, there
>> are no properties telling you what's the name of the endpoint / service
>> of this bean. (at least I do not know any)
>> Maybe the channel or the component context can tell you something, but I
>> am wondering why do you need that information. Much more interesting
>> values are the targetService and targetEndpoint properties. If you want
>> such things, then create these properties inside your bean as private
>> variables and put the corresponding getters and setters in the code as
>> well. Then you should have access to these values from within your code.
>> 
>> Lars
>> 
>> 
>> 
>> 
>> 
>> rgavlin schrieb:
>>> Within my code, I want to know the service QName and the endpoint name
>>> that
>>> was "configured" for my endpoint. In other words, I want to know the
>>> information from the xbean.xml file that was used to configure my
>>> ServiceEndpoint instance. Does that make sense?
>>>
>>> - Ron
>>>
>>>
>>> lhe77 wrote:
>>>   
>>>> I think you can't "calculate" it. The service or endpoint is a thing of
>>>> your configuration. What you can do of course is routing a message to a
>>>> specific service depending on the content of the message.
>>>> Otherwise you have to set your targetService / targetEndpoint to suit
>>>> your
>>>> needs.
>>>>
>>>> Regards
>>>> Lars
>>>>
>>>>
>>>>
>>>>
>>>> rgavlin schrieb:
>>>>     
>>>>> Greetings,
>>>>>
>>>>> I have a servicemix-bean similar to the example ListenerBean
>>>>> (http://incubator.apache.org/servicemix/dist/servicemix-3.1-incubating/site/deployables/serviceengines/servicemix-bean/xref-test/org/apache/servicemix/bean/beans/ListenerBean.html).
>>>>> Within onMessageExchange(), how can I calculate the relevant service &
>>>>> endpoint values?
>>>>>
>>>>> Thanks in advance.
>>>>>
>>>>> - Ron
>>>>>   
>>>>>       
>>>>     
>>>
>>>   
>> 
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Calculating-service---endpoint-from-within-servicemix-bean.onMessageExchange%28%29-tp16533225p16540908.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: Calculating service & endpoint from within servicemix-bean.onMessageExchange()

Posted by rgavlin <rg...@yahoo.com>.
Hi Lars,

I am in the process of trying to port the functionality offered by the
deprecated lw-container TransformComponentSupport.java base class to a
servicemix-bean base class (see JIRA
https://issues.apache.org/activemq/browse/SM-1305). The line of code in
question is 

outExchange.setProperty(JbiConstants.SENDER_ENDPOINT, getService() + ":" +
getEndpoint());

(see
http://www.koders.com/java/fid258A2E5D6391E440CF23016392548C199B5C31BF.aspx#L62)

The old lw-container components had a constructor which supplied the service
QName and the endpoint name. This is not the case for a servicemix-bean
Pojo. Is this information available to the Pojo via the ComponentContext or
is it guaranteed to be present somewhere in the MessageExchange parameter
supplied to the onMessageExchange(MessageExchange) method? Is there another
mechanism to capture this information?

Thanks in advance for your assistance.

- Ron



lhe77 wrote:
> 
> As you have a bean only which implements the listener interface, there
> are no properties telling you what's the name of the endpoint / service
> of this bean. (at least I do not know any)
> Maybe the channel or the component context can tell you something, but I
> am wondering why do you need that information. Much more interesting
> values are the targetService and targetEndpoint properties. If you want
> such things, then create these properties inside your bean as private
> variables and put the corresponding getters and setters in the code as
> well. Then you should have access to these values from within your code.
> 
> Lars
> 
> 
> 
> 
> 
> rgavlin schrieb:
>> Within my code, I want to know the service QName and the endpoint name
>> that
>> was "configured" for my endpoint. In other words, I want to know the
>> information from the xbean.xml file that was used to configure my
>> ServiceEndpoint instance. Does that make sense?
>>
>> - Ron
>>
>>
>> lhe77 wrote:
>>   
>>> I think you can't "calculate" it. The service or endpoint is a thing of
>>> your configuration. What you can do of course is routing a message to a
>>> specific service depending on the content of the message.
>>> Otherwise you have to set your targetService / targetEndpoint to suit
>>> your
>>> needs.
>>>
>>> Regards
>>> Lars
>>>
>>>
>>>
>>>
>>> rgavlin schrieb:
>>>     
>>>> Greetings,
>>>>
>>>> I have a servicemix-bean similar to the example ListenerBean
>>>> (http://incubator.apache.org/servicemix/dist/servicemix-3.1-incubating/site/deployables/serviceengines/servicemix-bean/xref-test/org/apache/servicemix/bean/beans/ListenerBean.html).
>>>> Within onMessageExchange(), how can I calculate the relevant service &
>>>> endpoint values?
>>>>
>>>> Thanks in advance.
>>>>
>>>> - Ron
>>>>   
>>>>       
>>>     
>>
>>   
> 
> 

-- 
View this message in context: http://www.nabble.com/Calculating-service---endpoint-from-within-servicemix-bean.onMessageExchange%28%29-tp16533225p16538823.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: Calculating service & endpoint from within servicemix-bean.onMessageExchange()

Posted by Lars Heinemann <la...@compart.net>.
As you have a bean only which implements the listener interface, there
are no properties telling you what's the name of the endpoint / service
of this bean. (at least I do not know any)
Maybe the channel or the component context can tell you something, but I
am wondering why do you need that information. Much more interesting
values are the targetService and targetEndpoint properties. If you want
such things, then create these properties inside your bean as private
variables and put the corresponding getters and setters in the code as
well. Then you should have access to these values from within your code.

Lars





rgavlin schrieb:
> Within my code, I want to know the service QName and the endpoint name that
> was "configured" for my endpoint. In other words, I want to know the
> information from the xbean.xml file that was used to configure my
> ServiceEndpoint instance. Does that make sense?
>
> - Ron
>
>
> lhe77 wrote:
>   
>> I think you can't "calculate" it. The service or endpoint is a thing of
>> your configuration. What you can do of course is routing a message to a
>> specific service depending on the content of the message.
>> Otherwise you have to set your targetService / targetEndpoint to suit your
>> needs.
>>
>> Regards
>> Lars
>>
>>
>>
>>
>> rgavlin schrieb:
>>     
>>> Greetings,
>>>
>>> I have a servicemix-bean similar to the example ListenerBean
>>> (http://incubator.apache.org/servicemix/dist/servicemix-3.1-incubating/site/deployables/serviceengines/servicemix-bean/xref-test/org/apache/servicemix/bean/beans/ListenerBean.html).
>>> Within onMessageExchange(), how can I calculate the relevant service &
>>> endpoint values?
>>>
>>> Thanks in advance.
>>>
>>> - Ron
>>>   
>>>       
>>     
>
>   

Re: Calculating service & endpoint from within servicemix-bean.onMessageExchange()

Posted by rgavlin <rg...@yahoo.com>.
Within my code, I want to know the service QName and the endpoint name that
was "configured" for my endpoint. In other words, I want to know the
information from the xbean.xml file that was used to configure my
ServiceEndpoint instance. Does that make sense?

- Ron


lhe77 wrote:
> 
> I think you can't "calculate" it. The service or endpoint is a thing of
> your configuration. What you can do of course is routing a message to a
> specific service depending on the content of the message.
> Otherwise you have to set your targetService / targetEndpoint to suit your
> needs.
> 
> Regards
> Lars
> 
> 
> 
> 
> rgavlin schrieb:
>> Greetings,
>>
>> I have a servicemix-bean similar to the example ListenerBean
>> (http://incubator.apache.org/servicemix/dist/servicemix-3.1-incubating/site/deployables/serviceengines/servicemix-bean/xref-test/org/apache/servicemix/bean/beans/ListenerBean.html).
>> Within onMessageExchange(), how can I calculate the relevant service &
>> endpoint values?
>>
>> Thanks in advance.
>>
>> - Ron
>>   
> 
> 

-- 
View this message in context: http://www.nabble.com/Calculating-service---endpoint-from-within-servicemix-bean.onMessageExchange%28%29-tp16533225p16537243.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: Calculating service & endpoint from within servicemix-bean.onMessageExchange()

Posted by Lars Heinemann <la...@compart.net>.
I think you can't "calculate" it. The service or endpoint is a thing of your configuration. What you can do of course is routing a message to a specific service depending on the content of the message.
Otherwise you have to set your targetService / targetEndpoint to suit your needs.

Regards
Lars




rgavlin schrieb:
> Greetings,
>
> I have a servicemix-bean similar to the example ListenerBean
> (http://incubator.apache.org/servicemix/dist/servicemix-3.1-incubating/site/deployables/serviceengines/servicemix-bean/xref-test/org/apache/servicemix/bean/beans/ListenerBean.html).
> Within onMessageExchange(), how can I calculate the relevant service &
> endpoint values?
>
> Thanks in advance.
>
> - Ron
>