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/11/04 09:44:05 UTC
Re: Where does DeliveryChannel.send() to?
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.