Hi 

Thanks very much for your reply.

This is the MyReceiver code. 

public class MyReceiver implements MessageExchangeListener {

        @Resource
        private DeliveryChannel channel;

        public void onMessageExchange(MessageExchange me) throws 
MessagingException
{
                ExchangeStatus status = me.getStatus();
                logger.debug("Receive message " + me + " " + me.getStatus());
                if (status.equals(ExchangeStatus.DONE) == true
                                || status.equals(ExchangeStatus.ERROR)) {
                        return;
                }
                if (status == ExchangeStatus.ACTIVE) {
                        NormalizedMessage message = me.getMessage("in");
                        Source content = message.getContent();

                        try {
                                String body = (new 
SourceTransformer()).toString(content);
                                logger.debug("Get body:" + body);
                        } catch (TransformerException e) {
                                e.printStackTrace();
                        }
                        message.setContent(content);
                        me.setMessage(message, "out");
                        channel.send(me);

                }


Gert Vanthienen wrote:
> 
> Zhao Yi,
> 
> The URI you set on the @ExchangeTarget is correct.  Could you post the
> code for the MyReceiver bean as well?  The Destination interface sends
> an InOut exchange to that bean, so perhaps there's a problem in how
> that bean handle the InOut MEP and is that the cause of blocking the
> call indefinitely.
> 
> Regards,
> 
> Gert Vanthienen
> ------------------------
> Open Source SOA: http://fusesource.com
> Blog: http://gertvanthienen.blogspot.com/
> 
> 
> 
> 2009/11/16 youhaodeyi <[email protected]>:
>>
>> Hi,
>>
>> This is the xbean.xml:
>>
>> <?xml version="1.0" encoding="UTF-8"?>
>> <beans xmlns="http://www.springframework.org/schema/beans";
>>        xmlns:service="http://com.test.service";
>> xmlns:sm="http://servicemix.apache.org/config/1.0";
>>        xmlns:bean="http://servicemix.apache.org/bean/1.0";
>> xmlns:server="http://servicemix.apache.org/server";
>>        xmlns:xsi="http://http://www.w3.org/2001/XMLSchema-instance";
>>        xsi:schemaLocation="http://servicemix.apache.org/bean/1.0
>> http://servicemix.apache.org/schema/servicemix-bean-3.2.3.xsd
>>       http://www.springframework.org/schema/beans
>> http://www.springframework.org/schema/beans/spring-beans-2.0.xsd";>
>>
>>        <bean:endpoint service="service:myservice"
>>                endpoint="my_service_endpoint" bean="#receiver" />
>>        <bean id="receiver" class="MyService">
>>        </bean>
>> </beans>
>>
>> thanks,
>>
>> Zhao Yi
>>
>>
>> Gert Vanthienen wrote:
>>>
>>> L.S.,
>>>
>>> Could you paste us the xbean.xml for the
>>> {http://com.test.service}service endpoint you're trying to target?
>>> Perhaps it doesn't support the MEP or there's an error in the URI or
>>> something?  Are there any exception in the log for this message
>>> exchange?
>>>
>>> Regards,
>>>
>>> Gert Vanthienen
>>> ------------------------
>>> Open Source SOA: http://fusesource.com
>>> Blog: http://gertvanthienen.blogspot.com/
>>>
>>>
>>>
>>> 2009/11/16 youhaodeyi <[email protected]>:
>>>>
>>>> I have tried this method but the channel.send() will send a new message
>>>> to
>>>> the called service not reply.
>>>>
>>>> The future.get() method will block and never get reply message.
>>>>
>>>>
>>>> Maciek Prochniak wrote:
>>>>>
>>>>> it's covered here:
>>>>> http://servicemix.apache.org/servicemix-bean.html
>>>>> please, look at 'Message processing' example
>>>>>
>>>>> br, maciek
>>>>>
>>>>> On Sun, 2009-11-15 at 22:30 -0800, youhaodeyi wrote:
>>>>>> I use servicemix-bean component to deploy my service unit and set a
>>>>>> field
>>>>>> with @ExchangeTarget annotation. See below:
>>>>>>
>>>>>> @ExchangeTarget(uri = "service:http://com.test.service/myservice";)
>>>>>> public Destination target;
>>>>>>
>>>>>> future = target.send(targetMsg);
>>>>>> NormalizedMessage retMsg = future.get();
>>>>>>
>>>>>> target.send() is called to send the message to myservice and waiting
>>>>>> for
>>>>>> reply. How can I reply the message in myservice? myservice implements
>>>>>> MessageExchangeListener interface.
>>>>>>
>>>>>> thanks,
>>>>>>
>>>>>> Zhao Yi
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>
>>>> --
>>>> View this message in context:
>>>> http://old.nabble.com/How-can-I-send-synchronous-message-by-Destination--tp26367357p26368288.html
>>>> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>>>>
>>>>
>>>
>>>
>>> -----
>>> ---
>>> Gert Vanthienen
>>> http://gertvanthienen.blogspot.com
>>>
>>
>> --
>> View this message in context:
>> http://old.nabble.com/How-can-I-send-synchronous-message-by-Destination--tp26367357p26371272.html
>> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>>
>>
> 
> 
> -----
> ---
> Gert Vanthienen
> http://gertvanthienen.blogspot.com
> 

-- 
View this message in context: 
http://old.nabble.com/How-can-I-send-synchronous-message-by-Destination--tp26367357p26382967.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.

Reply via email to