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: [email protected]
> > 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: [email protected]
> >> ReplyTo: [email protected]
> >> 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.
> > 
> > 
> > 
> > 
> 

Reply via email to