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/16 07:30:48 UTC

How can I send synchronous message by Destination?

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--tp26367357p26367357.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: How can I send synchronous message by Destination?

Posted by Gert Vanthienen <ge...@gmail.com>.
L.S.,

After some further investigation, it looks like there was an issue
with servicemix-bean component in the 2008.01 version.  When using a
Destination to send a message from a bean that also implements the
MessageExchangeListener interface, the response is being sent to the
listener interface instead of being received by the Destination.  The
issue has been fixed in the 2009.01 version of the component (thanks
to Zhao Yi for testing on the different versions and confirming the
fix)

Regards,

Gert Vanthienen
------------------------
Open Source SOA: http://fusesource.com
Blog: http://gertvanthienen.blogspot.com/



2009/11/18 youhaodeyi <yo...@gmail.com>:
>
> Hi,
>
> I recreated a simple project to reproduce this problem. I attached the
> project file in zip format. You can extract it and there are three SU and
> one SA. The SU includes Consumer, service1 and service2.
>
> Consumer is a servicemix-http. It will send the message to service1.
>
> service1 is a servicemix-bean. It will send a synchronous to service2 and
> waiting for reply.
>
> service2 is a servicemix-bean. It receives message and send back.
>
> I do get an error in the log file. If you deploy this project and you will
> see the error log.
>
> thanks,
>
> Zhao Yi
>
>
> Gert Vanthienen wrote:
>>
>> L.S.,
>>
>> Could you post the 'consuming' bean's code and xbean.xml as well?
>> Could you post the exact messages with the exchange you found in the
>> log, so we can figure out exactly where things are going wrong?
>>
>> Regards,
>>
>> Gert Vanthienen
>> ------------------------
>> Open Source SOA: http://fusesource.com
>> Blog: http://gertvanthienen.blogspot.com/
>>
>>
>>
>> 2009/11/17 youhaodeyi <yo...@gmail.com>:
>>>
>>> Hi,
>>>
>>> I can see the log printed by my class. There are 3 times for the same
>>> exchange, but all of them are ACTIVE, no DONE message found.
>>>
>>> Regards,
>>>
>>> Zhao Yi
>>>
>>>
>>> Gert Vanthienen wrote:
>>>>
>>>> Zhao Yi,
>>>>
>>>> This class looks OK to me.  Are you seeing the debug messages from
>>>> this class printed in your log file when you do the send?
>>>>
>>>> Could you try enabling DEBUG logging for this InOut exchange?  You
>>>> should see the same exchange pass through the NMR 3 times: once ACTIVE
>>>> (with only the in message), another ACTIVE (with both the in and out
>>>> message) and finally DONE.  Are there any exceptions or error in the
>>>> log that can help us figure out what the problem is?
>>>>
>>>> Regards,
>>>>
>>>> Gert Vanthienen
>>>> ------------------------
>>>> Open Source SOA: http://fusesource.com
>>>> Blog: http://gertvanthienen.blogspot.com/
>>>>
>>>>
>>>>
>>>> 2009/11/17 youhaodeyi <yo...@gmail.com>:
>>>>>
>>>>> 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 <yo...@gmail.com>:
>>>>>>>
>>>>>>> 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 <yo...@gmail.com>:
>>>>>>>>>
>>>>>>>>> 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.
>>>>>
>>>>>
>>>>
>>>>
>>>> -----
>>>> ---
>>>> Gert Vanthienen
>>>> http://gertvanthienen.blogspot.com
>>>>
>>>
>>> --
>>> View this message in context:
>>> http://old.nabble.com/How-can-I-send-synchronous-message-by-Destination--tp26367357p26387229.html
>>> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>>>
>>>
>>
>>
>> -----
>> ---
>> Gert Vanthienen
>> http://gertvanthienen.blogspot.com
>>
> http://old.nabble.com/file/p26402009/test.zip test.zip
> --
> View this message in context: http://old.nabble.com/How-can-I-send-synchronous-message-by-Destination--tp26367357p26402009.html
> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>
>

Re: How can I send synchronous message by Destination?

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

I recreated a simple project to reproduce this problem. I attached the
project file in zip format. You can extract it and there are three SU and
one SA. The SU includes Consumer, service1 and service2. 

Consumer is a servicemix-http. It will send the message to service1.

service1 is a servicemix-bean. It will send a synchronous to service2 and
waiting for reply. 

service2 is a servicemix-bean. It receives message and send back.

I do get an error in the log file. If you deploy this project and you will
see the error log.

thanks,

Zhao Yi


Gert Vanthienen wrote:
> 
> L.S.,
> 
> Could you post the 'consuming' bean's code and xbean.xml as well?
> Could you post the exact messages with the exchange you found in the
> log, so we can figure out exactly where things are going wrong?
> 
> Regards,
> 
> Gert Vanthienen
> ------------------------
> Open Source SOA: http://fusesource.com
> Blog: http://gertvanthienen.blogspot.com/
> 
> 
> 
> 2009/11/17 youhaodeyi <yo...@gmail.com>:
>>
>> Hi,
>>
>> I can see the log printed by my class. There are 3 times for the same
>> exchange, but all of them are ACTIVE, no DONE message found.
>>
>> Regards,
>>
>> Zhao Yi
>>
>>
>> Gert Vanthienen wrote:
>>>
>>> Zhao Yi,
>>>
>>> This class looks OK to me.  Are you seeing the debug messages from
>>> this class printed in your log file when you do the send?
>>>
>>> Could you try enabling DEBUG logging for this InOut exchange?  You
>>> should see the same exchange pass through the NMR 3 times: once ACTIVE
>>> (with only the in message), another ACTIVE (with both the in and out
>>> message) and finally DONE.  Are there any exceptions or error in the
>>> log that can help us figure out what the problem is?
>>>
>>> Regards,
>>>
>>> Gert Vanthienen
>>> ------------------------
>>> Open Source SOA: http://fusesource.com
>>> Blog: http://gertvanthienen.blogspot.com/
>>>
>>>
>>>
>>> 2009/11/17 youhaodeyi <yo...@gmail.com>:
>>>>
>>>> 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 <yo...@gmail.com>:
>>>>>>
>>>>>> 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 <yo...@gmail.com>:
>>>>>>>>
>>>>>>>> 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.
>>>>
>>>>
>>>
>>>
>>> -----
>>> ---
>>> Gert Vanthienen
>>> http://gertvanthienen.blogspot.com
>>>
>>
>> --
>> View this message in context:
>> http://old.nabble.com/How-can-I-send-synchronous-message-by-Destination--tp26367357p26387229.html
>> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>>
>>
> 
> 
> -----
> ---
> Gert Vanthienen
> http://gertvanthienen.blogspot.com
> 
http://old.nabble.com/file/p26402009/test.zip test.zip 
-- 
View this message in context: http://old.nabble.com/How-can-I-send-synchronous-message-by-Destination--tp26367357p26402009.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: How can I send synchronous message by Destination?

Posted by Gert Vanthienen <ge...@gmail.com>.
L.S.,

Could you post the 'consuming' bean's code and xbean.xml as well?
Could you post the exact messages with the exchange you found in the
log, so we can figure out exactly where things are going wrong?

Regards,

Gert Vanthienen
------------------------
Open Source SOA: http://fusesource.com
Blog: http://gertvanthienen.blogspot.com/



2009/11/17 youhaodeyi <yo...@gmail.com>:
>
> Hi,
>
> I can see the log printed by my class. There are 3 times for the same
> exchange, but all of them are ACTIVE, no DONE message found.
>
> Regards,
>
> Zhao Yi
>
>
> Gert Vanthienen wrote:
>>
>> Zhao Yi,
>>
>> This class looks OK to me.  Are you seeing the debug messages from
>> this class printed in your log file when you do the send?
>>
>> Could you try enabling DEBUG logging for this InOut exchange?  You
>> should see the same exchange pass through the NMR 3 times: once ACTIVE
>> (with only the in message), another ACTIVE (with both the in and out
>> message) and finally DONE.  Are there any exceptions or error in the
>> log that can help us figure out what the problem is?
>>
>> Regards,
>>
>> Gert Vanthienen
>> ------------------------
>> Open Source SOA: http://fusesource.com
>> Blog: http://gertvanthienen.blogspot.com/
>>
>>
>>
>> 2009/11/17 youhaodeyi <yo...@gmail.com>:
>>>
>>> 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 <yo...@gmail.com>:
>>>>>
>>>>> 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 <yo...@gmail.com>:
>>>>>>>
>>>>>>> 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.
>>>
>>>
>>
>>
>> -----
>> ---
>> Gert Vanthienen
>> http://gertvanthienen.blogspot.com
>>
>
> --
> View this message in context: http://old.nabble.com/How-can-I-send-synchronous-message-by-Destination--tp26367357p26387229.html
> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>
>

Re: How can I send synchronous message by Destination?

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

I can see the log printed by my class. There are 3 times for the same
exchange, but all of them are ACTIVE, no DONE message found.

Regards,

Zhao Yi


Gert Vanthienen wrote:
> 
> Zhao Yi,
> 
> This class looks OK to me.  Are you seeing the debug messages from
> this class printed in your log file when you do the send?
> 
> Could you try enabling DEBUG logging for this InOut exchange?  You
> should see the same exchange pass through the NMR 3 times: once ACTIVE
> (with only the in message), another ACTIVE (with both the in and out
> message) and finally DONE.  Are there any exceptions or error in the
> log that can help us figure out what the problem is?
> 
> Regards,
> 
> Gert Vanthienen
> ------------------------
> Open Source SOA: http://fusesource.com
> Blog: http://gertvanthienen.blogspot.com/
> 
> 
> 
> 2009/11/17 youhaodeyi <yo...@gmail.com>:
>>
>> 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 <yo...@gmail.com>:
>>>>
>>>> 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 <yo...@gmail.com>:
>>>>>>
>>>>>> 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.
>>
>>
> 
> 
> -----
> ---
> Gert Vanthienen
> http://gertvanthienen.blogspot.com
> 

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


Re: How can I send synchronous message by Destination?

Posted by Gert Vanthienen <ge...@gmail.com>.
Zhao Yi,

This class looks OK to me.  Are you seeing the debug messages from
this class printed in your log file when you do the send?

Could you try enabling DEBUG logging for this InOut exchange?  You
should see the same exchange pass through the NMR 3 times: once ACTIVE
(with only the in message), another ACTIVE (with both the in and out
message) and finally DONE.  Are there any exceptions or error in the
log that can help us figure out what the problem is?

Regards,

Gert Vanthienen
------------------------
Open Source SOA: http://fusesource.com
Blog: http://gertvanthienen.blogspot.com/



2009/11/17 youhaodeyi <yo...@gmail.com>:
>
> 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 <yo...@gmail.com>:
>>>
>>> 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 <yo...@gmail.com>:
>>>>>
>>>>> 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.
>
>

Re: How can I send synchronous message by Destination?

Posted by youhaodeyi <yo...@gmail.com>.
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 <yo...@gmail.com>:
>>
>> 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 <yo...@gmail.com>:
>>>>
>>>> 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.


Re: How can I send synchronous message by Destination?

Posted by Gert Vanthienen <ge...@gmail.com>.
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 <yo...@gmail.com>:
>
> 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 <yo...@gmail.com>:
>>>
>>> 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.
>
>

Re: How can I send synchronous message by Destination?

Posted by youhaodeyi <yo...@gmail.com>.
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 <yo...@gmail.com>:
>>
>> 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.


Re: How can I send synchronous message by Destination?

Posted by Gert Vanthienen <ge...@gmail.com>.
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 <yo...@gmail.com>:
>
> 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.
>
>

Re: How can I send synchronous message by Destination?

Posted by youhaodeyi <yo...@gmail.com>.
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.


Re: How can I send synchronous message by Destination?

Posted by Maciej Prochniak <mp...@touk.pl>.
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
> 
>