You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by youhaodeyi <yo...@gmail.com> on 2009/10/27 02:17:32 UTC

Where does DeliveryChannel.send() to?

When I call DeliveryChannel.send(), where does the message go? how can I set
the destination?

thanks.
-- 
View this message in context: http://www.nabble.com/Where-does-DeliveryChannel.send%28%29-to--tp26070654p26070654.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: Where does DeliveryChannel.send() to?

Posted by youhaodeyi <yo...@gmail.com>.
Hi,

I define a bean component and want to route this message to another SU. How
can I set its target service?

thanks


Jean-Baptiste Onofré wrote:
> 
> Hi,
> 
> DeliveryChannel is part of JBI specification. So when you call send()
> method on it, the exchange containing the normalized message is send into
> the Normalized Router (NMR). The message is routed to the destination
> using exchange properties (target service, target endpoint, MEP, ...).
> 
> Regards
> JB
> ------Original Message------
> From: youhaodeyi
> To: users@servicemix.apache.org
> ReplyTo: users@servicemix.apache.org
> Subject: Where does DeliveryChannel.send() to?
> Sent: Oct 27, 2009 02:17
> 
> 
> When I call DeliveryChannel.send(), where does the message go? how can I
> set
> the destination?
> 
> thanks.
> -- 
> View this message in context:
> http://www.nabble.com/Where-does-DeliveryChannel.send%28%29-to--tp26070654p26070654.html
> Sent from the ServiceMix - User mailing list archive at Nabble.com.
> 
> 
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Where-does-DeliveryChannel.send%28%29-to--tp26070654p26072560.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: Where does DeliveryChannel.send() to?

Posted by Maciej Prochniak <mp...@touk.pl>.
On Sat, 2009-11-14 at 17:22 -0800, youhaodeyi wrote:
> Yes I mean plug-in the xbean.xml.
> 
> What I want to do is to make the service url be configured.
> In addition, can I use Destination to send message to a service by service
> name or endpoint name not url? I have a service doesn't have an URL. How can
> I send message to this service?

what do you mean by service that doesn't have URL??
Each service is identified on NMR by uri - if you use form of
urn:foo:bar:MyService:MyEndpoint - then you can also use it 
in Destination configuration.

About configuration in xbean.xml - I think it's easiest
to inject just the URI of target service - e.g.
have destinationServiceURI property (string) in bean implementing
MessageExchangeListener, and then just use it to create
destination

br,
maciek

> thanks,
> 
> Zhao Yi
> 
> 
> Maciek Prochniak wrote:
> > 
> > it's in  org.apache.servicemix.bean.support package (servicemix-bean).
> > 
> > What do you mean by 'plugin-in in configuration file'?
> > Define it in xbean.xml?
> > 
> > br,
> > maciek
> > 
> > 
> > On Sat, 14 Nov 2009 02:57:44 -0800 (PST), youhaodeyi
> > <yo...@gmail.com>
> > wrote: 
> >> Where is DestinationImpl defined? Can I plug-in it in the configuration
> >> file?
> >> 
> >> 
> >> Maciek Prochniak wrote:
> >>> 
> >>> Well, guess you could try to do sth like:
> >>> 
> >>> Destination target = new
> >>> DestinationImpl("service:http://the.service.you.want.to.route",
> >>> beanEndpoint);
> >>> 
> >>> where the beanEndpoint is the bean created by 
> >>> 
> >>> <bean:endpoint service="uncompress_service"
> >>> endpoint="uncompress_service_endpoint" bean="#receiver" />
> >>> 
> >>> but it's kind of clumsy, and IMHO it's far easier to use camel for such
> >>> purpose
> >>> 
> >>> br,
> >>> maciek
> >>> 
> >>> On Wed, 2009-10-28 at 17:48 -0700, youhaodeyi wrote:
> >>>> Hello,
> >>>> 
> >>>> Thanks for your information.
> >>>> 
> >>>> In this way, I have to configure the target service in code which can't
> >>>> be
> >>>> modified at runtime. Can I configure this in a configuration? Does
> >>>> servicemix support something like outbound router?
> >>>> 
> >>>> Regards
> >>>> 
> >>>> 
> >>>> Maciek Prochniak wrote:
> >>>> > 
> >>>> > Hello, 
> >>>> > we are using the following in such situation:
> >>>> > 
> >>>> > Instance variables:
> >>>> > 
> >>>> > @Resource 
> >>>> > private DeliveryChannel channel; 
> >>>> > 
> >>>> > @ExchangeTarget(uri="service:http://the.service.you.want.to.route")
> >>>> > private Destination target;
> >>>> > 
> >>>> > routing to another service:
> >>>> >  NormalizedMessage nm = target.createMessage();
> >>>> >  nm.setContent(new StringSource("<bububub/>"));
> >>>> >  nm.setProperty("fileId", "parara");
> >>>> > //you receive Future<NormalizedMessage> object
> >>>> >  target.send(nm);
> >>>> > 
> >>>> > There are some caveats in this approach:
> >>>> > 1. target.createMessage() can only create InOut message exchanges.
> >>>> > 2. onMessageExchange method is invoked in different contexts, this is
> >>>> > the code that finally worked for us:
> >>>> >  public void onMessageExchange(MessageExchange me) throws
> >>>> > MessagingException {
> >>>> >   //our bean is receiving request, otherwise it's reply from
> >>>> > target.send
> >>>> >   if (me.getRole().equals(Role.PROVIDER)) {
> >>>> >     //do the real stuff
> >>>> >     process();
> >>>> >   } 
> >>>> >   //we have to acknowledge - otherwise e.g. memory leaks may happen  
> >>>> >
> >>>> >   if (me.getStatus().equals(ExchangeStatus.ACTIVE)) {
> >>>> >   	me.setStatus(ExchangeStatus.DONE); 
> >>>> >   	channel.send(me); 
> >>>> >   }
> >>>> > }
> >>>> >    
> >>>> > hope this helps 
> >>>> > 
> >>>> > br, 
> >>>> > maciek
> >>>> > 
> >>>> > 
> >>>> > 
> >>>> > On Mon, 2009-10-26 at 23:23 -0700, youhaodeyi wrote:
> >>>> >> Hi,
> >>>> >> 
> >>>> >> This is my xbean.xml file:
> >>>> >> 
> >>>> >> <beans>
> >>>> >> 
> >>>> >> 	<bean:endpoint service="uncompress_service"
> >>>> >> endpoint="uncompress_service_endpoint"
> >>>> >> 		bean="#receiver" />
> >>>> >> 
> >>>> >> 	<bean id="receiver"
> > class="com.ge.med.ric.service.UncompressService"
> >>>> />
> >>>> >> 
> >>>> >> </beans>
> >>>> >> 
> >>>> >> The bean implements MessageExchangeListener interface. I want to
> >>>> >> route
> >>>> >> the
> >>>> >> message to another bean service.
> >>>> >> 
> >>>> >> 
> >>>> >> 
> >>>> >> 
> >>>> >> Jean-Baptiste Onofré wrote:
> >>>> >> > 
> >>>> >> > Your bean components implements which interface: listener,
> > consumer
> >>>> ?
> >>>> >> > ------Original Message------
> >>>> >> > From: youhaodeyi
> >>>> >> > To: users@servicemix.apache.org
> >>>> >> > Subject: Re: Where does DeliveryChannel.send() to?
> >>>> >> > Sent: Oct 27, 2009 07:08
> >>>> >> > 
> >>>> >> > 
> >>>> >> > Hi,
> >>>> >> > 
> >>>> >> > I define a bean component and want to route this message to
> > another
> >>>> SU.
> >>>> >> > How
> >>>> >> > can I set its target service?
> >>>> >> > 
> >>>> >> > thanks
> >>>> >> > 
> >>>> >> > 
> >>>> >> > Jean-Baptiste Onofré wrote:
> >>>> >> >> 
> >>>> >> >> Hi,
> >>>> >> >> 
> >>>> >> >> DeliveryChannel is part of JBI specification. So when you call
> >>>> send()
> >>>> >> >> method on it, the exchange containing the normalized message is
> >>>> send
> >>>> >> into
> >>>> >> >> the Normalized Router (NMR). The message is routed to the
> >>>> destination
> >>>> >> >> using exchange properties (target service, target endpoint, MEP,
> >>>> ...).
> >>>> >> >> 
> >>>> >> >> Regards
> >>>> >> >> JB
> >>>> >> >> ------Original Message------
> >>>> >> >> From: youhaodeyi
> >>>> >> >> To: users@servicemix.apache.org
> >>>> >> >> ReplyTo: users@servicemix.apache.org
> >>>> >> >> Subject: Where does DeliveryChannel.send() to?
> >>>> >> >> Sent: Oct 27, 2009 02:17
> >>>> >> >> 
> >>>> >> >> 
> >>>> >> >> When I call DeliveryChannel.send(), where does the message go?
> > how
> >>>> can
> >>>> >> I
> >>>> >> >> set
> >>>> >> >> the destination?
> >>>> >> >> 
> >>>> >> >> thanks.
> >>>> >> >> -- 
> >>>> >> >> View this message in context:
> >>>> >> >>
> >>>> >>
> >>>>
> > http://www.nabble.com/Where-does-DeliveryChannel.send%28%29-to--tp26070654p26070654.html
> >>>> >> >> Sent from the ServiceMix - User mailing list archive at
> >>>> >> >> Nabble.com.
> >>>> >> >> 
> >>>> >> >> 
> >>>> >> >> 
> >>>> >> >> 
> >>>> >> >> 
> >>>> >> > 
> >>>> >> > -- 
> >>>> >> > View this message in context:
> >>>> >> >
> >>>> >>
> >>>>
> > http://www.nabble.com/Where-does-DeliveryChannel.send%28%29-to--tp26070654p26072560.html
> >>>> >> > Sent from the ServiceMix - User mailing list archive at
> > Nabble.com.
> >>>> >> > 
> >>>> >> > 
> >>>> >> > 
> >>>> >> > 
> >>>> >> 
> >>>> > 
> >>>> > 
> >>>> > 
> >>>> 
> >>> 
> >>> 
> >>>
> > 
> > 
> 


Re: Where does DeliveryChannel.send() to?

Posted by youhaodeyi <yo...@gmail.com>.
Yes I mean plug-in the xbean.xml.

What I want to do is to make the service url be configured.
In addition, can I use Destination to send message to a service by service
name or endpoint name not url? I have a service doesn't have an URL. How can
I send message to this service?

thanks,

Zhao Yi


Maciek Prochniak wrote:
> 
> it's in  org.apache.servicemix.bean.support package (servicemix-bean).
> 
> What do you mean by 'plugin-in in configuration file'?
> Define it in xbean.xml?
> 
> br,
> maciek
> 
> 
> On Sat, 14 Nov 2009 02:57:44 -0800 (PST), youhaodeyi
> <yo...@gmail.com>
> wrote: 
>> Where is DestinationImpl defined? Can I plug-in it in the configuration
>> file?
>> 
>> 
>> Maciek Prochniak wrote:
>>> 
>>> Well, guess you could try to do sth like:
>>> 
>>> Destination target = new
>>> DestinationImpl("service:http://the.service.you.want.to.route",
>>> beanEndpoint);
>>> 
>>> where the beanEndpoint is the bean created by 
>>> 
>>> <bean:endpoint service="uncompress_service"
>>> endpoint="uncompress_service_endpoint" bean="#receiver" />
>>> 
>>> but it's kind of clumsy, and IMHO it's far easier to use camel for such
>>> purpose
>>> 
>>> br,
>>> maciek
>>> 
>>> On Wed, 2009-10-28 at 17:48 -0700, youhaodeyi wrote:
>>>> Hello,
>>>> 
>>>> Thanks for your information.
>>>> 
>>>> In this way, I have to configure the target service in code which can't
>>>> be
>>>> modified at runtime. Can I configure this in a configuration? Does
>>>> servicemix support something like outbound router?
>>>> 
>>>> Regards
>>>> 
>>>> 
>>>> Maciek Prochniak wrote:
>>>> > 
>>>> > Hello, 
>>>> > we are using the following in such situation:
>>>> > 
>>>> > Instance variables:
>>>> > 
>>>> > @Resource 
>>>> > private DeliveryChannel channel; 
>>>> > 
>>>> > @ExchangeTarget(uri="service:http://the.service.you.want.to.route")
>>>> > private Destination target;
>>>> > 
>>>> > routing to another service:
>>>> >  NormalizedMessage nm = target.createMessage();
>>>> >  nm.setContent(new StringSource("<bububub/>"));
>>>> >  nm.setProperty("fileId", "parara");
>>>> > //you receive Future<NormalizedMessage> object
>>>> >  target.send(nm);
>>>> > 
>>>> > There are some caveats in this approach:
>>>> > 1. target.createMessage() can only create InOut message exchanges.
>>>> > 2. onMessageExchange method is invoked in different contexts, this is
>>>> > the code that finally worked for us:
>>>> >  public void onMessageExchange(MessageExchange me) throws
>>>> > MessagingException {
>>>> >   //our bean is receiving request, otherwise it's reply from
>>>> > target.send
>>>> >   if (me.getRole().equals(Role.PROVIDER)) {
>>>> >     //do the real stuff
>>>> >     process();
>>>> >   } 
>>>> >   //we have to acknowledge - otherwise e.g. memory leaks may happen  
>>>> >
>>>> >   if (me.getStatus().equals(ExchangeStatus.ACTIVE)) {
>>>> >   	me.setStatus(ExchangeStatus.DONE); 
>>>> >   	channel.send(me); 
>>>> >   }
>>>> > }
>>>> >    
>>>> > hope this helps 
>>>> > 
>>>> > br, 
>>>> > maciek
>>>> > 
>>>> > 
>>>> > 
>>>> > On Mon, 2009-10-26 at 23:23 -0700, youhaodeyi wrote:
>>>> >> Hi,
>>>> >> 
>>>> >> This is my xbean.xml file:
>>>> >> 
>>>> >> <beans>
>>>> >> 
>>>> >> 	<bean:endpoint service="uncompress_service"
>>>> >> endpoint="uncompress_service_endpoint"
>>>> >> 		bean="#receiver" />
>>>> >> 
>>>> >> 	<bean id="receiver"
> class="com.ge.med.ric.service.UncompressService"
>>>> />
>>>> >> 
>>>> >> </beans>
>>>> >> 
>>>> >> The bean implements MessageExchangeListener interface. I want to
>>>> >> route
>>>> >> the
>>>> >> message to another bean service.
>>>> >> 
>>>> >> 
>>>> >> 
>>>> >> 
>>>> >> Jean-Baptiste Onofré wrote:
>>>> >> > 
>>>> >> > Your bean components implements which interface: listener,
> consumer
>>>> ?
>>>> >> > ------Original Message------
>>>> >> > From: youhaodeyi
>>>> >> > To: users@servicemix.apache.org
>>>> >> > Subject: Re: Where does DeliveryChannel.send() to?
>>>> >> > Sent: Oct 27, 2009 07:08
>>>> >> > 
>>>> >> > 
>>>> >> > Hi,
>>>> >> > 
>>>> >> > I define a bean component and want to route this message to
> another
>>>> SU.
>>>> >> > How
>>>> >> > can I set its target service?
>>>> >> > 
>>>> >> > thanks
>>>> >> > 
>>>> >> > 
>>>> >> > Jean-Baptiste Onofré wrote:
>>>> >> >> 
>>>> >> >> Hi,
>>>> >> >> 
>>>> >> >> DeliveryChannel is part of JBI specification. So when you call
>>>> send()
>>>> >> >> method on it, the exchange containing the normalized message is
>>>> send
>>>> >> into
>>>> >> >> the Normalized Router (NMR). The message is routed to the
>>>> destination
>>>> >> >> using exchange properties (target service, target endpoint, MEP,
>>>> ...).
>>>> >> >> 
>>>> >> >> Regards
>>>> >> >> JB
>>>> >> >> ------Original Message------
>>>> >> >> From: youhaodeyi
>>>> >> >> To: users@servicemix.apache.org
>>>> >> >> ReplyTo: users@servicemix.apache.org
>>>> >> >> Subject: Where does DeliveryChannel.send() to?
>>>> >> >> Sent: Oct 27, 2009 02:17
>>>> >> >> 
>>>> >> >> 
>>>> >> >> When I call DeliveryChannel.send(), where does the message go?
> how
>>>> can
>>>> >> I
>>>> >> >> set
>>>> >> >> the destination?
>>>> >> >> 
>>>> >> >> thanks.
>>>> >> >> -- 
>>>> >> >> View this message in context:
>>>> >> >>
>>>> >>
>>>>
> http://www.nabble.com/Where-does-DeliveryChannel.send%28%29-to--tp26070654p26070654.html
>>>> >> >> Sent from the ServiceMix - User mailing list archive at
>>>> >> >> Nabble.com.
>>>> >> >> 
>>>> >> >> 
>>>> >> >> 
>>>> >> >> 
>>>> >> >> 
>>>> >> > 
>>>> >> > -- 
>>>> >> > View this message in context:
>>>> >> >
>>>> >>
>>>>
> http://www.nabble.com/Where-does-DeliveryChannel.send%28%29-to--tp26070654p26072560.html
>>>> >> > Sent from the ServiceMix - User mailing list archive at
> Nabble.com.
>>>> >> > 
>>>> >> > 
>>>> >> > 
>>>> >> > 
>>>> >> 
>>>> > 
>>>> > 
>>>> > 
>>>> 
>>> 
>>> 
>>>
> 
> 

-- 
View this message in context: http://old.nabble.com/Where-does-DeliveryChannel.send%28%29-to--tp26070654p26355581.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: Where does DeliveryChannel.send() to?

Posted by Maciej Próchniak <mp...@touk.pl>.
it's in  org.apache.servicemix.bean.support package (servicemix-bean).

What do you mean by 'plugin-in in configuration file'?
Define it in xbean.xml?

br,
maciek


On Sat, 14 Nov 2009 02:57:44 -0800 (PST), youhaodeyi <yo...@gmail.com>
wrote: 
> Where is DestinationImpl defined? Can I plug-in it in the configuration
> file?
> 
> 
> Maciek Prochniak wrote:
>> 
>> Well, guess you could try to do sth like:
>> 
>> Destination target = new
>> DestinationImpl("service:http://the.service.you.want.to.route",
>> beanEndpoint);
>> 
>> where the beanEndpoint is the bean created by 
>> 
>> <bean:endpoint service="uncompress_service"
>> endpoint="uncompress_service_endpoint" bean="#receiver" />
>> 
>> but it's kind of clumsy, and IMHO it's far easier to use camel for such
>> purpose
>> 
>> br,
>> maciek
>> 
>> On Wed, 2009-10-28 at 17:48 -0700, youhaodeyi wrote:
>>> Hello,
>>> 
>>> Thanks for your information.
>>> 
>>> In this way, I have to configure the target service in code which can't
>>> be
>>> modified at runtime. Can I configure this in a configuration? Does
>>> servicemix support something like outbound router?
>>> 
>>> Regards
>>> 
>>> 
>>> Maciek Prochniak wrote:
>>> > 
>>> > Hello, 
>>> > we are using the following in such situation:
>>> > 
>>> > Instance variables:
>>> > 
>>> > @Resource 
>>> > private DeliveryChannel channel; 
>>> > 
>>> > @ExchangeTarget(uri="service:http://the.service.you.want.to.route")
>>> > private Destination target;
>>> > 
>>> > routing to another service:
>>> >  NormalizedMessage nm = target.createMessage();
>>> >  nm.setContent(new StringSource("<bububub/>"));
>>> >  nm.setProperty("fileId", "parara");
>>> > //you receive Future<NormalizedMessage> object
>>> >  target.send(nm);
>>> > 
>>> > There are some caveats in this approach:
>>> > 1. target.createMessage() can only create InOut message exchanges.
>>> > 2. onMessageExchange method is invoked in different contexts, this is
>>> > the code that finally worked for us:
>>> >  public void onMessageExchange(MessageExchange me) throws
>>> > MessagingException {
>>> >   //our bean is receiving request, otherwise it's reply from
>>> > target.send
>>> >   if (me.getRole().equals(Role.PROVIDER)) {
>>> >     //do the real stuff
>>> >     process();
>>> >   } 
>>> >   //we have to acknowledge - otherwise e.g. memory leaks may happen  
>>> >
>>> >   if (me.getStatus().equals(ExchangeStatus.ACTIVE)) {
>>> >   	me.setStatus(ExchangeStatus.DONE); 
>>> >   	channel.send(me); 
>>> >   }
>>> > }
>>> >    
>>> > hope this helps 
>>> > 
>>> > br, 
>>> > maciek
>>> > 
>>> > 
>>> > 
>>> > On Mon, 2009-10-26 at 23:23 -0700, youhaodeyi wrote:
>>> >> Hi,
>>> >> 
>>> >> This is my xbean.xml file:
>>> >> 
>>> >> <beans>
>>> >> 
>>> >> 	<bean:endpoint service="uncompress_service"
>>> >> endpoint="uncompress_service_endpoint"
>>> >> 		bean="#receiver" />
>>> >> 
>>> >> 	<bean id="receiver"
class="com.ge.med.ric.service.UncompressService"
>>> />
>>> >> 
>>> >> </beans>
>>> >> 
>>> >> The bean implements MessageExchangeListener interface. I want to
>>> >> route
>>> >> the
>>> >> message to another bean service.
>>> >> 
>>> >> 
>>> >> 
>>> >> 
>>> >> Jean-Baptiste Onofré wrote:
>>> >> > 
>>> >> > Your bean components implements which interface: listener,
consumer
>>> ?
>>> >> > ------Original Message------
>>> >> > From: youhaodeyi
>>> >> > To: users@servicemix.apache.org
>>> >> > Subject: Re: Where does DeliveryChannel.send() to?
>>> >> > Sent: Oct 27, 2009 07:08
>>> >> > 
>>> >> > 
>>> >> > Hi,
>>> >> > 
>>> >> > I define a bean component and want to route this message to
another
>>> SU.
>>> >> > How
>>> >> > can I set its target service?
>>> >> > 
>>> >> > thanks
>>> >> > 
>>> >> > 
>>> >> > Jean-Baptiste Onofré wrote:
>>> >> >> 
>>> >> >> Hi,
>>> >> >> 
>>> >> >> DeliveryChannel is part of JBI specification. So when you call
>>> send()
>>> >> >> method on it, the exchange containing the normalized message is
>>> send
>>> >> into
>>> >> >> the Normalized Router (NMR). The message is routed to the
>>> destination
>>> >> >> using exchange properties (target service, target endpoint, MEP,
>>> ...).
>>> >> >> 
>>> >> >> Regards
>>> >> >> JB
>>> >> >> ------Original Message------
>>> >> >> From: youhaodeyi
>>> >> >> To: users@servicemix.apache.org
>>> >> >> ReplyTo: users@servicemix.apache.org
>>> >> >> Subject: Where does DeliveryChannel.send() to?
>>> >> >> Sent: Oct 27, 2009 02:17
>>> >> >> 
>>> >> >> 
>>> >> >> When I call DeliveryChannel.send(), where does the message go?
how
>>> can
>>> >> I
>>> >> >> set
>>> >> >> the destination?
>>> >> >> 
>>> >> >> thanks.
>>> >> >> -- 
>>> >> >> View this message in context:
>>> >> >>
>>> >>
>>>
http://www.nabble.com/Where-does-DeliveryChannel.send%28%29-to--tp26070654p26070654.html
>>> >> >> Sent from the ServiceMix - User mailing list archive at
>>> >> >> Nabble.com.
>>> >> >> 
>>> >> >> 
>>> >> >> 
>>> >> >> 
>>> >> >> 
>>> >> > 
>>> >> > -- 
>>> >> > View this message in context:
>>> >> >
>>> >>
>>>
http://www.nabble.com/Where-does-DeliveryChannel.send%28%29-to--tp26070654p26072560.html
>>> >> > Sent from the ServiceMix - User mailing list archive at
Nabble.com.
>>> >> > 
>>> >> > 
>>> >> > 
>>> >> > 
>>> >> 
>>> > 
>>> > 
>>> > 
>>> 
>> 
>> 
>>

Re: Where does DeliveryChannel.send() to?

Posted by youhaodeyi <yo...@gmail.com>.
Where is DestinationImpl defined? Can I plug-in it in the configuration file?


Maciek Prochniak wrote:
> 
> Well, guess you could try to do sth like:
> 
> Destination target = new
> DestinationImpl("service:http://the.service.you.want.to.route",
> beanEndpoint);
> 
> where the beanEndpoint is the bean created by 
> 
> <bean:endpoint service="uncompress_service"
> endpoint="uncompress_service_endpoint" bean="#receiver" />
> 
> but it's kind of clumsy, and IMHO it's far easier to use camel for such
> purpose
> 
> br,
> maciek
> 
> On Wed, 2009-10-28 at 17:48 -0700, youhaodeyi wrote:
>> Hello,
>> 
>> Thanks for your information.
>> 
>> In this way, I have to configure the target service in code which can't
>> be
>> modified at runtime. Can I configure this in a configuration? Does
>> servicemix support something like outbound router?
>> 
>> Regards
>> 
>> 
>> Maciek Prochniak wrote:
>> > 
>> > Hello, 
>> > we are using the following in such situation:
>> > 
>> > Instance variables:
>> > 
>> > @Resource 
>> > private DeliveryChannel channel; 
>> > 
>> > @ExchangeTarget(uri="service:http://the.service.you.want.to.route")
>> > private Destination target;
>> > 
>> > routing to another service:
>> >  NormalizedMessage nm = target.createMessage();
>> >  nm.setContent(new StringSource("<bububub/>"));
>> >  nm.setProperty("fileId", "parara");
>> > //you receive Future<NormalizedMessage> object
>> >  target.send(nm);
>> > 
>> > There are some caveats in this approach:
>> > 1. target.createMessage() can only create InOut message exchanges.
>> > 2. onMessageExchange method is invoked in different contexts, this is
>> > the code that finally worked for us:
>> >  public void onMessageExchange(MessageExchange me) throws
>> > MessagingException {
>> >   //our bean is receiving request, otherwise it's reply from
>> > target.send
>> >   if (me.getRole().equals(Role.PROVIDER)) {
>> >     //do the real stuff
>> >     process();
>> >   } 
>> >   //we have to acknowledge - otherwise e.g. memory leaks may happen   	
>> >   if (me.getStatus().equals(ExchangeStatus.ACTIVE)) {
>> >   	me.setStatus(ExchangeStatus.DONE); 
>> >   	channel.send(me); 
>> >   }
>> > }
>> >    
>> > hope this helps 
>> > 
>> > br, 
>> > maciek
>> > 
>> > 
>> > 
>> > On Mon, 2009-10-26 at 23:23 -0700, youhaodeyi wrote:
>> >> Hi,
>> >> 
>> >> This is my xbean.xml file:
>> >> 
>> >> <beans>
>> >> 
>> >> 	<bean:endpoint service="uncompress_service"
>> >> endpoint="uncompress_service_endpoint"
>> >> 		bean="#receiver" />
>> >> 
>> >> 	<bean id="receiver" class="com.ge.med.ric.service.UncompressService"
>> />
>> >> 
>> >> </beans>
>> >> 
>> >> The bean implements MessageExchangeListener interface. I want to route
>> >> the
>> >> message to another bean service.
>> >> 
>> >> 
>> >> 
>> >> 
>> >> Jean-Baptiste Onofré wrote:
>> >> > 
>> >> > Your bean components implements which interface: listener, consumer
>> ?
>> >> > ------Original Message------
>> >> > From: youhaodeyi
>> >> > To: users@servicemix.apache.org
>> >> > Subject: Re: Where does DeliveryChannel.send() to?
>> >> > Sent: Oct 27, 2009 07:08
>> >> > 
>> >> > 
>> >> > Hi,
>> >> > 
>> >> > I define a bean component and want to route this message to another
>> SU.
>> >> > How
>> >> > can I set its target service?
>> >> > 
>> >> > thanks
>> >> > 
>> >> > 
>> >> > Jean-Baptiste Onofré wrote:
>> >> >> 
>> >> >> Hi,
>> >> >> 
>> >> >> DeliveryChannel is part of JBI specification. So when you call
>> send()
>> >> >> method on it, the exchange containing the normalized message is
>> send
>> >> into
>> >> >> the Normalized Router (NMR). The message is routed to the
>> destination
>> >> >> using exchange properties (target service, target endpoint, MEP,
>> ...).
>> >> >> 
>> >> >> Regards
>> >> >> JB
>> >> >> ------Original Message------
>> >> >> From: youhaodeyi
>> >> >> To: users@servicemix.apache.org
>> >> >> ReplyTo: users@servicemix.apache.org
>> >> >> Subject: Where does DeliveryChannel.send() to?
>> >> >> Sent: Oct 27, 2009 02:17
>> >> >> 
>> >> >> 
>> >> >> When I call DeliveryChannel.send(), where does the message go? how
>> can
>> >> I
>> >> >> set
>> >> >> the destination?
>> >> >> 
>> >> >> thanks.
>> >> >> -- 
>> >> >> View this message in context:
>> >> >>
>> >>
>> http://www.nabble.com/Where-does-DeliveryChannel.send%28%29-to--tp26070654p26070654.html
>> >> >> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>> >> >> 
>> >> >> 
>> >> >> 
>> >> >> 
>> >> >> 
>> >> > 
>> >> > -- 
>> >> > View this message in context:
>> >> >
>> >>
>> http://www.nabble.com/Where-does-DeliveryChannel.send%28%29-to--tp26070654p26072560.html
>> >> > Sent from the ServiceMix - User mailing list archive at Nabble.com.
>> >> > 
>> >> > 
>> >> > 
>> >> > 
>> >> 
>> > 
>> > 
>> > 
>> 
> 
> 
> 

-- 
View this message in context: http://old.nabble.com/Where-does-DeliveryChannel.send%28%29-to--tp26070654p26349090.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: Where does DeliveryChannel.send() to?

Posted by youhaodeyi <yo...@gmail.com>.
Hi,

How about if I want to send reply message to client first and then route the
message to another SE?


Maciek Prochniak wrote:
> 
> Well, guess you could try to do sth like:
> 
> Destination target = new
> DestinationImpl("service:http://the.service.you.want.to.route",
> beanEndpoint);
> 
> where the beanEndpoint is the bean created by 
> 
> <bean:endpoint service="uncompress_service"
> endpoint="uncompress_service_endpoint" bean="#receiver" />
> 
> but it's kind of clumsy, and IMHO it's far easier to use camel for such
> purpose
> 
> br,
> maciek
> 
> On Wed, 2009-10-28 at 17:48 -0700, youhaodeyi wrote:
>> Hello,
>> 
>> Thanks for your information.
>> 
>> In this way, I have to configure the target service in code which can't
>> be
>> modified at runtime. Can I configure this in a configuration? Does
>> servicemix support something like outbound router?
>> 
>> Regards
>> 
>> 
>> Maciek Prochniak wrote:
>> > 
>> > Hello, 
>> > we are using the following in such situation:
>> > 
>> > Instance variables:
>> > 
>> > @Resource 
>> > private DeliveryChannel channel; 
>> > 
>> > @ExchangeTarget(uri="service:http://the.service.you.want.to.route")
>> > private Destination target;
>> > 
>> > routing to another service:
>> >  NormalizedMessage nm = target.createMessage();
>> >  nm.setContent(new StringSource("<bububub/>"));
>> >  nm.setProperty("fileId", "parara");
>> > //you receive Future<NormalizedMessage> object
>> >  target.send(nm);
>> > 
>> > There are some caveats in this approach:
>> > 1. target.createMessage() can only create InOut message exchanges.
>> > 2. onMessageExchange method is invoked in different contexts, this is
>> > the code that finally worked for us:
>> >  public void onMessageExchange(MessageExchange me) throws
>> > MessagingException {
>> >   //our bean is receiving request, otherwise it's reply from
>> > target.send
>> >   if (me.getRole().equals(Role.PROVIDER)) {
>> >     //do the real stuff
>> >     process();
>> >   } 
>> >   //we have to acknowledge - otherwise e.g. memory leaks may happen   	
>> >   if (me.getStatus().equals(ExchangeStatus.ACTIVE)) {
>> >   	me.setStatus(ExchangeStatus.DONE); 
>> >   	channel.send(me); 
>> >   }
>> > }
>> >    
>> > hope this helps 
>> > 
>> > br, 
>> > maciek
>> > 
>> > 
>> > 
>> > On Mon, 2009-10-26 at 23:23 -0700, youhaodeyi wrote:
>> >> Hi,
>> >> 
>> >> This is my xbean.xml file:
>> >> 
>> >> <beans>
>> >> 
>> >> 	<bean:endpoint service="uncompress_service"
>> >> endpoint="uncompress_service_endpoint"
>> >> 		bean="#receiver" />
>> >> 
>> >> 	<bean id="receiver" class="com.ge.med.ric.service.UncompressService"
>> />
>> >> 
>> >> </beans>
>> >> 
>> >> The bean implements MessageExchangeListener interface. I want to route
>> >> the
>> >> message to another bean service.
>> >> 
>> >> 
>> >> 
>> >> 
>> >> Jean-Baptiste Onofré wrote:
>> >> > 
>> >> > Your bean components implements which interface: listener, consumer
>> ?
>> >> > ------Original Message------
>> >> > From: youhaodeyi
>> >> > To: users@servicemix.apache.org
>> >> > Subject: Re: Where does DeliveryChannel.send() to?
>> >> > Sent: Oct 27, 2009 07:08
>> >> > 
>> >> > 
>> >> > Hi,
>> >> > 
>> >> > I define a bean component and want to route this message to another
>> SU.
>> >> > How
>> >> > can I set its target service?
>> >> > 
>> >> > thanks
>> >> > 
>> >> > 
>> >> > Jean-Baptiste Onofré wrote:
>> >> >> 
>> >> >> Hi,
>> >> >> 
>> >> >> DeliveryChannel is part of JBI specification. So when you call
>> send()
>> >> >> method on it, the exchange containing the normalized message is
>> send
>> >> into
>> >> >> the Normalized Router (NMR). The message is routed to the
>> destination
>> >> >> using exchange properties (target service, target endpoint, MEP,
>> ...).
>> >> >> 
>> >> >> Regards
>> >> >> JB
>> >> >> ------Original Message------
>> >> >> From: youhaodeyi
>> >> >> To: users@servicemix.apache.org
>> >> >> ReplyTo: users@servicemix.apache.org
>> >> >> Subject: Where does DeliveryChannel.send() to?
>> >> >> Sent: Oct 27, 2009 02:17
>> >> >> 
>> >> >> 
>> >> >> When I call DeliveryChannel.send(), where does the message go? how
>> can
>> >> I
>> >> >> set
>> >> >> the destination?
>> >> >> 
>> >> >> thanks.
>> >> >> -- 
>> >> >> View this message in context:
>> >> >>
>> >>
>> http://www.nabble.com/Where-does-DeliveryChannel.send%28%29-to--tp26070654p26070654.html
>> >> >> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>> >> >> 
>> >> >> 
>> >> >> 
>> >> >> 
>> >> >> 
>> >> > 
>> >> > -- 
>> >> > View this message in context:
>> >> >
>> >>
>> http://www.nabble.com/Where-does-DeliveryChannel.send%28%29-to--tp26070654p26072560.html
>> >> > Sent from the ServiceMix - User mailing list archive at Nabble.com.
>> >> > 
>> >> > 
>> >> > 
>> >> > 
>> >> 
>> > 
>> > 
>> > 
>> 
> 
> 
> 

-- 
View this message in context: http://old.nabble.com/Where-does-DeliveryChannel.send%28%29-to--tp26070654p26192754.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: Where does DeliveryChannel.send() to?

Posted by Maciej Prochniak <mp...@touk.pl>.
Well, guess you could try to do sth like:

Destination target = new
DestinationImpl("service:http://the.service.you.want.to.route",
beanEndpoint);

where the beanEndpoint is the bean created by 

<bean:endpoint service="uncompress_service"
endpoint="uncompress_service_endpoint" bean="#receiver" />

but it's kind of clumsy, and IMHO it's far easier to use camel for such
purpose

br,
maciek

On Wed, 2009-10-28 at 17:48 -0700, youhaodeyi wrote:
> Hello,
> 
> Thanks for your information.
> 
> In this way, I have to configure the target service in code which can't be
> modified at runtime. Can I configure this in a configuration? Does
> servicemix support something like outbound router?
> 
> Regards
> 
> 
> Maciek Prochniak wrote:
> > 
> > Hello, 
> > we are using the following in such situation:
> > 
> > Instance variables:
> > 
> > @Resource 
> > private DeliveryChannel channel; 
> > 
> > @ExchangeTarget(uri="service:http://the.service.you.want.to.route")
> > private Destination target;
> > 
> > routing to another service:
> >  NormalizedMessage nm = target.createMessage();
> >  nm.setContent(new StringSource("<bububub/>"));
> >  nm.setProperty("fileId", "parara");
> > //you receive Future<NormalizedMessage> object
> >  target.send(nm);
> > 
> > There are some caveats in this approach:
> > 1. target.createMessage() can only create InOut message exchanges.
> > 2. onMessageExchange method is invoked in different contexts, this is
> > the code that finally worked for us:
> >  public void onMessageExchange(MessageExchange me) throws
> > MessagingException {
> >   //our bean is receiving request, otherwise it's reply from
> > target.send
> >   if (me.getRole().equals(Role.PROVIDER)) {
> >     //do the real stuff
> >     process();
> >   } 
> >   //we have to acknowledge - otherwise e.g. memory leaks may happen   	
> >   if (me.getStatus().equals(ExchangeStatus.ACTIVE)) {
> >   	me.setStatus(ExchangeStatus.DONE); 
> >   	channel.send(me); 
> >   }
> > }
> >    
> > hope this helps 
> > 
> > br, 
> > maciek
> > 
> > 
> > 
> > On Mon, 2009-10-26 at 23:23 -0700, youhaodeyi wrote:
> >> Hi,
> >> 
> >> This is my xbean.xml file:
> >> 
> >> <beans>
> >> 
> >> 	<bean:endpoint service="uncompress_service"
> >> endpoint="uncompress_service_endpoint"
> >> 		bean="#receiver" />
> >> 
> >> 	<bean id="receiver" class="com.ge.med.ric.service.UncompressService" />
> >> 
> >> </beans>
> >> 
> >> The bean implements MessageExchangeListener interface. I want to route
> >> the
> >> message to another bean service.
> >> 
> >> 
> >> 
> >> 
> >> Jean-Baptiste Onofré wrote:
> >> > 
> >> > Your bean components implements which interface: listener, consumer ?
> >> > ------Original Message------
> >> > From: youhaodeyi
> >> > To: users@servicemix.apache.org
> >> > Subject: Re: Where does DeliveryChannel.send() to?
> >> > Sent: Oct 27, 2009 07:08
> >> > 
> >> > 
> >> > Hi,
> >> > 
> >> > I define a bean component and want to route this message to another SU.
> >> > How
> >> > can I set its target service?
> >> > 
> >> > thanks
> >> > 
> >> > 
> >> > Jean-Baptiste Onofré wrote:
> >> >> 
> >> >> Hi,
> >> >> 
> >> >> DeliveryChannel is part of JBI specification. So when you call send()
> >> >> method on it, the exchange containing the normalized message is send
> >> into
> >> >> the Normalized Router (NMR). The message is routed to the destination
> >> >> using exchange properties (target service, target endpoint, MEP, ...).
> >> >> 
> >> >> Regards
> >> >> JB
> >> >> ------Original Message------
> >> >> From: youhaodeyi
> >> >> To: users@servicemix.apache.org
> >> >> ReplyTo: users@servicemix.apache.org
> >> >> Subject: Where does DeliveryChannel.send() to?
> >> >> Sent: Oct 27, 2009 02:17
> >> >> 
> >> >> 
> >> >> When I call DeliveryChannel.send(), where does the message go? how can
> >> I
> >> >> set
> >> >> the destination?
> >> >> 
> >> >> thanks.
> >> >> -- 
> >> >> View this message in context:
> >> >>
> >> http://www.nabble.com/Where-does-DeliveryChannel.send%28%29-to--tp26070654p26070654.html
> >> >> Sent from the ServiceMix - User mailing list archive at Nabble.com.
> >> >> 
> >> >> 
> >> >> 
> >> >> 
> >> >> 
> >> > 
> >> > -- 
> >> > View this message in context:
> >> >
> >> http://www.nabble.com/Where-does-DeliveryChannel.send%28%29-to--tp26070654p26072560.html
> >> > Sent from the ServiceMix - User mailing list archive at Nabble.com.
> >> > 
> >> > 
> >> > 
> >> > 
> >> 
> > 
> > 
> > 
> 


Re: Where does DeliveryChannel.send() to?

Posted by youhaodeyi <yo...@gmail.com>.
Hello,

Thanks for your information.

In this way, I have to configure the target service in code which can't be
modified at runtime. Can I configure this in a configuration? Does
servicemix support something like outbound router?

Regards


Maciek Prochniak wrote:
> 
> Hello, 
> we are using the following in such situation:
> 
> Instance variables:
> 
> @Resource 
> private DeliveryChannel channel; 
> 
> @ExchangeTarget(uri="service:http://the.service.you.want.to.route")
> private Destination target;
> 
> routing to another service:
>  NormalizedMessage nm = target.createMessage();
>  nm.setContent(new StringSource("<bububub/>"));
>  nm.setProperty("fileId", "parara");
> //you receive Future<NormalizedMessage> object
>  target.send(nm);
> 
> There are some caveats in this approach:
> 1. target.createMessage() can only create InOut message exchanges.
> 2. onMessageExchange method is invoked in different contexts, this is
> the code that finally worked for us:
>  public void onMessageExchange(MessageExchange me) throws
> MessagingException {
>   //our bean is receiving request, otherwise it's reply from
> target.send
>   if (me.getRole().equals(Role.PROVIDER)) {
>     //do the real stuff
>     process();
>   } 
>   //we have to acknowledge - otherwise e.g. memory leaks may happen   	
>   if (me.getStatus().equals(ExchangeStatus.ACTIVE)) {
>   	me.setStatus(ExchangeStatus.DONE); 
>   	channel.send(me); 
>   }
> }
>    
> hope this helps 
> 
> br, 
> maciek
> 
> 
> 
> On Mon, 2009-10-26 at 23:23 -0700, youhaodeyi wrote:
>> Hi,
>> 
>> This is my xbean.xml file:
>> 
>> <beans>
>> 
>> 	<bean:endpoint service="uncompress_service"
>> endpoint="uncompress_service_endpoint"
>> 		bean="#receiver" />
>> 
>> 	<bean id="receiver" class="com.ge.med.ric.service.UncompressService" />
>> 
>> </beans>
>> 
>> The bean implements MessageExchangeListener interface. I want to route
>> the
>> message to another bean service.
>> 
>> 
>> 
>> 
>> Jean-Baptiste Onofré wrote:
>> > 
>> > Your bean components implements which interface: listener, consumer ?
>> > ------Original Message------
>> > From: youhaodeyi
>> > To: users@servicemix.apache.org
>> > Subject: Re: Where does DeliveryChannel.send() to?
>> > Sent: Oct 27, 2009 07:08
>> > 
>> > 
>> > Hi,
>> > 
>> > I define a bean component and want to route this message to another SU.
>> > How
>> > can I set its target service?
>> > 
>> > thanks
>> > 
>> > 
>> > Jean-Baptiste Onofré wrote:
>> >> 
>> >> Hi,
>> >> 
>> >> DeliveryChannel is part of JBI specification. So when you call send()
>> >> method on it, the exchange containing the normalized message is send
>> into
>> >> the Normalized Router (NMR). The message is routed to the destination
>> >> using exchange properties (target service, target endpoint, MEP, ...).
>> >> 
>> >> Regards
>> >> JB
>> >> ------Original Message------
>> >> From: youhaodeyi
>> >> To: users@servicemix.apache.org
>> >> ReplyTo: users@servicemix.apache.org
>> >> Subject: Where does DeliveryChannel.send() to?
>> >> Sent: Oct 27, 2009 02:17
>> >> 
>> >> 
>> >> When I call DeliveryChannel.send(), where does the message go? how can
>> I
>> >> set
>> >> the destination?
>> >> 
>> >> thanks.
>> >> -- 
>> >> View this message in context:
>> >>
>> http://www.nabble.com/Where-does-DeliveryChannel.send%28%29-to--tp26070654p26070654.html
>> >> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>> >> 
>> >> 
>> >> 
>> >> 
>> >> 
>> > 
>> > -- 
>> > View this message in context:
>> >
>> http://www.nabble.com/Where-does-DeliveryChannel.send%28%29-to--tp26070654p26072560.html
>> > Sent from the ServiceMix - User mailing list archive at Nabble.com.
>> > 
>> > 
>> > 
>> > 
>> 
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Where-does-DeliveryChannel.send%28%29-to--tp26070654p26104552.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: Where does DeliveryChannel.send() to?

Posted by Maciej Prochniak <mp...@touk.pl>.
in smx 3.3, it has signature in Destination interface:
Future<NormalizedMessage> send(NormalizedMessage message).
Which version are you using?

br, maciek


On Sat, 2009-11-14 at 17:46 -0800, youhaodeyi wrote:
> Hi,
> 
> I don't find send() method in Destination class. How can you send message to
> the target service?
> 
> thanks,
> 
> Zhao Yi
> 
> Maciek Prochniak wrote:
> > 
> > Hello, 
> > we are using the following in such situation:
> > 
> > Instance variables:
> > 
> > @Resource 
> > private DeliveryChannel channel; 
> > 
> > @ExchangeTarget(uri="service:http://the.service.you.want.to.route")
> > private Destination target;
> > 
> > routing to another service:
> >  NormalizedMessage nm = target.createMessage();
> >  nm.setContent(new StringSource("<bububub/>"));
> >  nm.setProperty("fileId", "parara");
> > //you receive Future<NormalizedMessage> object
> >  target.send(nm);
> > 
> > There are some caveats in this approach:
> > 1. target.createMessage() can only create InOut message exchanges.
> > 2. onMessageExchange method is invoked in different contexts, this is
> > the code that finally worked for us:
> >  public void onMessageExchange(MessageExchange me) throws
> > MessagingException {
> >   //our bean is receiving request, otherwise it's reply from
> > target.send
> >   if (me.getRole().equals(Role.PROVIDER)) {
> >     //do the real stuff
> >     process();
> >   } 
> >   //we have to acknowledge - otherwise e.g. memory leaks may happen   	
> >   if (me.getStatus().equals(ExchangeStatus.ACTIVE)) {
> >   	me.setStatus(ExchangeStatus.DONE); 
> >   	channel.send(me); 
> >   }
> > }
> >    
> > hope this helps 
> > 
> > br, 
> > maciek
> > 
> > 
> > 
> > On Mon, 2009-10-26 at 23:23 -0700, youhaodeyi wrote:
> >> Hi,
> >> 
> >> This is my xbean.xml file:
> >> 
> >> <beans>
> >> 
> >> 	<bean:endpoint service="uncompress_service"
> >> endpoint="uncompress_service_endpoint"
> >> 		bean="#receiver" />
> >> 
> >> 	<bean id="receiver" class="com.ge.med.ric.service.UncompressService" />
> >> 
> >> </beans>
> >> 
> >> The bean implements MessageExchangeListener interface. I want to route
> >> the
> >> message to another bean service.
> >> 
> >> 
> >> 
> >> 
> >> Jean-Baptiste Onofré wrote:
> >> > 
> >> > Your bean components implements which interface: listener, consumer ?
> >> > ------Original Message------
> >> > From: youhaodeyi
> >> > To: users@servicemix.apache.org
> >> > Subject: Re: Where does DeliveryChannel.send() to?
> >> > Sent: Oct 27, 2009 07:08
> >> > 
> >> > 
> >> > Hi,
> >> > 
> >> > I define a bean component and want to route this message to another SU.
> >> > How
> >> > can I set its target service?
> >> > 
> >> > thanks
> >> > 
> >> > 
> >> > Jean-Baptiste Onofré wrote:
> >> >> 
> >> >> Hi,
> >> >> 
> >> >> DeliveryChannel is part of JBI specification. So when you call send()
> >> >> method on it, the exchange containing the normalized message is send
> >> into
> >> >> the Normalized Router (NMR). The message is routed to the destination
> >> >> using exchange properties (target service, target endpoint, MEP, ...).
> >> >> 
> >> >> Regards
> >> >> JB
> >> >> ------Original Message------
> >> >> From: youhaodeyi
> >> >> To: users@servicemix.apache.org
> >> >> ReplyTo: users@servicemix.apache.org
> >> >> Subject: Where does DeliveryChannel.send() to?
> >> >> Sent: Oct 27, 2009 02:17
> >> >> 
> >> >> 
> >> >> When I call DeliveryChannel.send(), where does the message go? how can
> >> I
> >> >> set
> >> >> the destination?
> >> >> 
> >> >> thanks.
> >> >> -- 
> >> >> View this message in context:
> >> >>
> >> http://www.nabble.com/Where-does-DeliveryChannel.send%28%29-to--tp26070654p26070654.html
> >> >> Sent from the ServiceMix - User mailing list archive at Nabble.com.
> >> >> 
> >> >> 
> >> >> 
> >> >> 
> >> >> 
> >> > 
> >> > -- 
> >> > View this message in context:
> >> >
> >> http://www.nabble.com/Where-does-DeliveryChannel.send%28%29-to--tp26070654p26072560.html
> >> > Sent from the ServiceMix - User mailing list archive at Nabble.com.
> >> > 
> >> > 
> >> > 
> >> > 
> >> 
> > 
> > 
> > 
> 


Re: Where does DeliveryChannel.send() to?

Posted by youhaodeyi <yo...@gmail.com>.
Hi,

I don't find send() method in Destination class. How can you send message to
the target service?

thanks,

Zhao Yi

Maciek Prochniak wrote:
> 
> Hello, 
> we are using the following in such situation:
> 
> Instance variables:
> 
> @Resource 
> private DeliveryChannel channel; 
> 
> @ExchangeTarget(uri="service:http://the.service.you.want.to.route")
> private Destination target;
> 
> routing to another service:
>  NormalizedMessage nm = target.createMessage();
>  nm.setContent(new StringSource("<bububub/>"));
>  nm.setProperty("fileId", "parara");
> //you receive Future<NormalizedMessage> object
>  target.send(nm);
> 
> There are some caveats in this approach:
> 1. target.createMessage() can only create InOut message exchanges.
> 2. onMessageExchange method is invoked in different contexts, this is
> the code that finally worked for us:
>  public void onMessageExchange(MessageExchange me) throws
> MessagingException {
>   //our bean is receiving request, otherwise it's reply from
> target.send
>   if (me.getRole().equals(Role.PROVIDER)) {
>     //do the real stuff
>     process();
>   } 
>   //we have to acknowledge - otherwise e.g. memory leaks may happen   	
>   if (me.getStatus().equals(ExchangeStatus.ACTIVE)) {
>   	me.setStatus(ExchangeStatus.DONE); 
>   	channel.send(me); 
>   }
> }
>    
> hope this helps 
> 
> br, 
> maciek
> 
> 
> 
> On Mon, 2009-10-26 at 23:23 -0700, youhaodeyi wrote:
>> Hi,
>> 
>> This is my xbean.xml file:
>> 
>> <beans>
>> 
>> 	<bean:endpoint service="uncompress_service"
>> endpoint="uncompress_service_endpoint"
>> 		bean="#receiver" />
>> 
>> 	<bean id="receiver" class="com.ge.med.ric.service.UncompressService" />
>> 
>> </beans>
>> 
>> The bean implements MessageExchangeListener interface. I want to route
>> the
>> message to another bean service.
>> 
>> 
>> 
>> 
>> Jean-Baptiste Onofré wrote:
>> > 
>> > Your bean components implements which interface: listener, consumer ?
>> > ------Original Message------
>> > From: youhaodeyi
>> > To: users@servicemix.apache.org
>> > Subject: Re: Where does DeliveryChannel.send() to?
>> > Sent: Oct 27, 2009 07:08
>> > 
>> > 
>> > Hi,
>> > 
>> > I define a bean component and want to route this message to another SU.
>> > How
>> > can I set its target service?
>> > 
>> > thanks
>> > 
>> > 
>> > Jean-Baptiste Onofré wrote:
>> >> 
>> >> Hi,
>> >> 
>> >> DeliveryChannel is part of JBI specification. So when you call send()
>> >> method on it, the exchange containing the normalized message is send
>> into
>> >> the Normalized Router (NMR). The message is routed to the destination
>> >> using exchange properties (target service, target endpoint, MEP, ...).
>> >> 
>> >> Regards
>> >> JB
>> >> ------Original Message------
>> >> From: youhaodeyi
>> >> To: users@servicemix.apache.org
>> >> ReplyTo: users@servicemix.apache.org
>> >> Subject: Where does DeliveryChannel.send() to?
>> >> Sent: Oct 27, 2009 02:17
>> >> 
>> >> 
>> >> When I call DeliveryChannel.send(), where does the message go? how can
>> I
>> >> set
>> >> the destination?
>> >> 
>> >> thanks.
>> >> -- 
>> >> View this message in context:
>> >>
>> http://www.nabble.com/Where-does-DeliveryChannel.send%28%29-to--tp26070654p26070654.html
>> >> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>> >> 
>> >> 
>> >> 
>> >> 
>> >> 
>> > 
>> > -- 
>> > View this message in context:
>> >
>> http://www.nabble.com/Where-does-DeliveryChannel.send%28%29-to--tp26070654p26072560.html
>> > Sent from the ServiceMix - User mailing list archive at Nabble.com.
>> > 
>> > 
>> > 
>> > 
>> 
> 
> 
> 

-- 
View this message in context: http://old.nabble.com/Where-does-DeliveryChannel.send%28%29-to--tp26070654p26355701.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: Where does DeliveryChannel.send() to?

Posted by Maciej Prochniak <mp...@touk.pl>.
Hello, 
we are using the following in such situation:

Instance variables:

@Resource 
private DeliveryChannel channel; 

@ExchangeTarget(uri="service:http://the.service.you.want.to.route")
private Destination target;

routing to another service:
 NormalizedMessage nm = target.createMessage();
 nm.setContent(new StringSource("<bububub/>"));
 nm.setProperty("fileId", "parara");
//you receive Future<NormalizedMessage> object
 target.send(nm);

There are some caveats in this approach:
1. target.createMessage() can only create InOut message exchanges.
2. onMessageExchange method is invoked in different contexts, this is
the code that finally worked for us:
 public void onMessageExchange(MessageExchange me) throws
MessagingException {
  //our bean is receiving request, otherwise it's reply from
target.send
  if (me.getRole().equals(Role.PROVIDER)) {
    //do the real stuff
    process();
  } 
  //we have to acknowledge - otherwise e.g. memory leaks may happen   	
  if (me.getStatus().equals(ExchangeStatus.ACTIVE)) {
  	me.setStatus(ExchangeStatus.DONE); 
  	channel.send(me); 
  }
}
   
hope this helps 

br, 
maciek



On Mon, 2009-10-26 at 23:23 -0700, youhaodeyi wrote:
> Hi,
> 
> This is my xbean.xml file:
> 
> <beans>
> 
> 	<bean:endpoint service="uncompress_service"
> endpoint="uncompress_service_endpoint"
> 		bean="#receiver" />
> 
> 	<bean id="receiver" class="com.ge.med.ric.service.UncompressService" />
> 
> </beans>
> 
> The bean implements MessageExchangeListener interface. I want to route the
> message to another bean service.
> 
> 
> 
> 
> Jean-Baptiste Onofré wrote:
> > 
> > Your bean components implements which interface: listener, consumer ?
> > ------Original Message------
> > From: youhaodeyi
> > To: users@servicemix.apache.org
> > Subject: Re: Where does DeliveryChannel.send() to?
> > Sent: Oct 27, 2009 07:08
> > 
> > 
> > Hi,
> > 
> > I define a bean component and want to route this message to another SU.
> > How
> > can I set its target service?
> > 
> > thanks
> > 
> > 
> > Jean-Baptiste Onofré wrote:
> >> 
> >> Hi,
> >> 
> >> DeliveryChannel is part of JBI specification. So when you call send()
> >> method on it, the exchange containing the normalized message is send into
> >> the Normalized Router (NMR). The message is routed to the destination
> >> using exchange properties (target service, target endpoint, MEP, ...).
> >> 
> >> Regards
> >> JB
> >> ------Original Message------
> >> From: youhaodeyi
> >> To: users@servicemix.apache.org
> >> ReplyTo: users@servicemix.apache.org
> >> Subject: Where does DeliveryChannel.send() to?
> >> Sent: Oct 27, 2009 02:17
> >> 
> >> 
> >> When I call DeliveryChannel.send(), where does the message go? how can I
> >> set
> >> the destination?
> >> 
> >> thanks.
> >> -- 
> >> View this message in context:
> >> http://www.nabble.com/Where-does-DeliveryChannel.send%28%29-to--tp26070654p26070654.html
> >> Sent from the ServiceMix - User mailing list archive at Nabble.com.
> >> 
> >> 
> >> 
> >> 
> >> 
> > 
> > -- 
> > View this message in context:
> > http://www.nabble.com/Where-does-DeliveryChannel.send%28%29-to--tp26070654p26072560.html
> > Sent from the ServiceMix - User mailing list archive at Nabble.com.
> > 
> > 
> > 
> > 
> 


Re: Where does DeliveryChannel.send() to?

Posted by youhaodeyi <yo...@gmail.com>.
Hi,

This is my xbean.xml file:

<beans>

	<bean:endpoint service="uncompress_service"
endpoint="uncompress_service_endpoint"
		bean="#receiver" />

	<bean id="receiver" class="com.ge.med.ric.service.UncompressService" />

</beans>

The bean implements MessageExchangeListener interface. I want to route the
message to another bean service.




Jean-Baptiste Onofré wrote:
> 
> Your bean components implements which interface: listener, consumer ?
> ------Original Message------
> From: youhaodeyi
> To: users@servicemix.apache.org
> Subject: Re: Where does DeliveryChannel.send() to?
> Sent: Oct 27, 2009 07:08
> 
> 
> Hi,
> 
> I define a bean component and want to route this message to another SU.
> How
> can I set its target service?
> 
> thanks
> 
> 
> Jean-Baptiste Onofré wrote:
>> 
>> Hi,
>> 
>> DeliveryChannel is part of JBI specification. So when you call send()
>> method on it, the exchange containing the normalized message is send into
>> the Normalized Router (NMR). The message is routed to the destination
>> using exchange properties (target service, target endpoint, MEP, ...).
>> 
>> Regards
>> JB
>> ------Original Message------
>> From: youhaodeyi
>> To: users@servicemix.apache.org
>> ReplyTo: users@servicemix.apache.org
>> Subject: Where does DeliveryChannel.send() to?
>> Sent: Oct 27, 2009 02:17
>> 
>> 
>> When I call DeliveryChannel.send(), where does the message go? how can I
>> set
>> the destination?
>> 
>> thanks.
>> -- 
>> View this message in context:
>> http://www.nabble.com/Where-does-DeliveryChannel.send%28%29-to--tp26070654p26070654.html
>> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>> 
>> 
>> 
>> 
>> 
> 
> -- 
> View this message in context:
> http://www.nabble.com/Where-does-DeliveryChannel.send%28%29-to--tp26070654p26072560.html
> Sent from the ServiceMix - User mailing list archive at Nabble.com.
> 
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Where-does-DeliveryChannel.send%28%29-to--tp26070654p26072663.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: Where does DeliveryChannel.send() to?

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Agreed. Let me check the servicemix-bean code and provide a feedback to you.

Regards
JB
-----Original Message-----
From: youhaodeyi <yo...@gmail.com>
Date: Mon, 26 Oct 2009 23:42:27 
To: <us...@servicemix.apache.org>
Subject: Re: Where does DeliveryChannel.send() to?


Using ServiceMixClient will add dependency in my bean which is not flexible.
Can I set the targetService in the xbean.xml file? In this way, I just call
send() method in my bean, it will route the message to the service specified
in the xbean.xml file.

In addition, does servicemix tutorial include this information?



Jean-Baptiste Onofré wrote:
> 
> Ok.
> 
> A solution is a to add some property to your bean
> (targetService/targetEndpoint for example). You cab create a
> ServiceMixClient in your bean and send the exchange ussing this client.
> Sorry I can't provide you some samples code for now (I'm in transit ;)).
> 
> Regards
> JB
> ------Original Message------
> From: youhaodeyi
> To: users@servicemix.apache.org
> Subject: Re: Where does DeliveryChannel.send() to?
> Sent: Oct 27, 2009 07:23
> 
> 
> Hi,
> 
> This is my xbean.xml file:
> 
> <beans>
> 
> 	<bean:endpoint service="uncompress_service"
> endpoint="uncompress_service_endpoint"
> 		bean="#receiver" />
> 
> 	<bean id="receiver" class="com.ge.med.ric.service.UncompressService" />
> 
> </beans>
> 
> The bean implements MessageExchangeListener interface. I want to route the
> message to another bean service.
> 
> 
> 
> 
> Jean-Baptiste Onofré wrote:
>> 
>> Your bean components implements which interface: listener, consumer ?
>> ------Original Message------
>> From: youhaodeyi
>> To: users@servicemix.apache.org
>> Subject: Re: Where does DeliveryChannel.send() to?
>> Sent: Oct 27, 2009 07:08
>> 
>> 
>> Hi,
>> 
>> I define a bean component and want to route this message to another SU.
>> How
>> can I set its target service?
>> 
>> thanks
>> 
>> 
>> Jean-Baptiste Onofré wrote:
>>> 
>>> Hi,
>>> 
>>> DeliveryChannel is part of JBI specification. So when you call send()
>>> method on it, the exchange containing the normalized message is send
>>> into
>>> the Normalized Router (NMR). The message is routed to the destination
>>> using exchange properties (target service, target endpoint, MEP, ...).
>>> 
>>> Regards
>>> JB
>>> ------Original Message------
>>> From: youhaodeyi
>>> To: users@servicemix.apache.org
>>> ReplyTo: users@servicemix.apache.org
>>> Subject: Where does DeliveryChannel.send() to?
>>> Sent: Oct 27, 2009 02:17
>>> 
>>> 
>>> When I call DeliveryChannel.send(), where does the message go? how can I
>>> set
>>> the destination?
>>> 
>>> thanks.
>>> -- 
>>> View this message in context:
>>> http://www.nabble.com/Where-does-DeliveryChannel.send%28%29-to--tp26070654p26070654.html
>>> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>>> 
>>> 
>>> 
>>> 
>>> 
>> 
>> -- 
>> View this message in context:
>> http://www.nabble.com/Where-does-DeliveryChannel.send%28%29-to--tp26070654p26072560.html
>> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>> 
>> 
>> 
>> 
> 
> -- 
> View this message in context:
> http://www.nabble.com/Where-does-DeliveryChannel.send%28%29-to--tp26070654p26072663.html
> Sent from the ServiceMix - User mailing list archive at Nabble.com.
> 
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Where-does-DeliveryChannel.send%28%29-to--tp26070654p26072828.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: Where does DeliveryChannel.send() to?

Posted by youhaodeyi <yo...@gmail.com>.
Using ServiceMixClient will add dependency in my bean which is not flexible.
Can I set the targetService in the xbean.xml file? In this way, I just call
send() method in my bean, it will route the message to the service specified
in the xbean.xml file.

In addition, does servicemix tutorial include this information?



Jean-Baptiste Onofré wrote:
> 
> Ok.
> 
> A solution is a to add some property to your bean
> (targetService/targetEndpoint for example). You cab create a
> ServiceMixClient in your bean and send the exchange ussing this client.
> Sorry I can't provide you some samples code for now (I'm in transit ;)).
> 
> Regards
> JB
> ------Original Message------
> From: youhaodeyi
> To: users@servicemix.apache.org
> Subject: Re: Where does DeliveryChannel.send() to?
> Sent: Oct 27, 2009 07:23
> 
> 
> Hi,
> 
> This is my xbean.xml file:
> 
> <beans>
> 
> 	<bean:endpoint service="uncompress_service"
> endpoint="uncompress_service_endpoint"
> 		bean="#receiver" />
> 
> 	<bean id="receiver" class="com.ge.med.ric.service.UncompressService" />
> 
> </beans>
> 
> The bean implements MessageExchangeListener interface. I want to route the
> message to another bean service.
> 
> 
> 
> 
> Jean-Baptiste Onofré wrote:
>> 
>> Your bean components implements which interface: listener, consumer ?
>> ------Original Message------
>> From: youhaodeyi
>> To: users@servicemix.apache.org
>> Subject: Re: Where does DeliveryChannel.send() to?
>> Sent: Oct 27, 2009 07:08
>> 
>> 
>> Hi,
>> 
>> I define a bean component and want to route this message to another SU.
>> How
>> can I set its target service?
>> 
>> thanks
>> 
>> 
>> Jean-Baptiste Onofré wrote:
>>> 
>>> Hi,
>>> 
>>> DeliveryChannel is part of JBI specification. So when you call send()
>>> method on it, the exchange containing the normalized message is send
>>> into
>>> the Normalized Router (NMR). The message is routed to the destination
>>> using exchange properties (target service, target endpoint, MEP, ...).
>>> 
>>> Regards
>>> JB
>>> ------Original Message------
>>> From: youhaodeyi
>>> To: users@servicemix.apache.org
>>> ReplyTo: users@servicemix.apache.org
>>> Subject: Where does DeliveryChannel.send() to?
>>> Sent: Oct 27, 2009 02:17
>>> 
>>> 
>>> When I call DeliveryChannel.send(), where does the message go? how can I
>>> set
>>> the destination?
>>> 
>>> thanks.
>>> -- 
>>> View this message in context:
>>> http://www.nabble.com/Where-does-DeliveryChannel.send%28%29-to--tp26070654p26070654.html
>>> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>>> 
>>> 
>>> 
>>> 
>>> 
>> 
>> -- 
>> View this message in context:
>> http://www.nabble.com/Where-does-DeliveryChannel.send%28%29-to--tp26070654p26072560.html
>> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>> 
>> 
>> 
>> 
> 
> -- 
> View this message in context:
> http://www.nabble.com/Where-does-DeliveryChannel.send%28%29-to--tp26070654p26072663.html
> Sent from the ServiceMix - User mailing list archive at Nabble.com.
> 
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Where-does-DeliveryChannel.send%28%29-to--tp26070654p26072828.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.