Hello Gert,
Here is the main piece of code that i have.
The test class code :
DefaultServiceMixClient client = new DefaultServiceMixClient(jbi);
InOnly me = client.createInOnlyExchange();
me.getInMessage().setProperty("property1", list);//List is filled
with some data
me.setService(new QName("urn:test", "service"));
client.sendSync(me);
//This is the code of actual endpoint
protected void processInOnly(MessageExchange exchange,
NormalizedMessage in) throws Exception {
if (in.getProperty("property1") != null) {
List dataList = (List) in
.getProperty("property1");
}
//This is sendSync part to the other component
//context here is the component context
final InOut inOutexchange = context.getDeliveryChannel()
.createExchangeFactory().createInOutExchange();
inOutexchange.setService(targetService);//targetService is
constructed one
final NormalizedMessage inMessage = inOutexchange.createMessage();
inMessage.setProperty("inProperty",/*Some Object*/);
inOutexchange.setMessage(inMessage, "in");
context.getDeliveryChannel().sendSync(inOutexchange);
NormalizedMessage outResponse = inOutexchange.getOutMessage();
and then work with out message to extract the required property.
Exception happens when sendSync is called.
//and this is the piece of code that i have in my testprovider end point
protected void processInOut(MessageExchange exchange,
NormalizedMessage in, NormalizedMessage out) throws Exception {
out.setProperty("property2",/* some constructed object*/);
exchange.setMessage(out, "out");
}
The spring.xml doesn't have any problem as it is able to recognise mocked
target service.
Do see any problem here? Or if there any other way with which i can test my
sendsync part plzz let me know.
Best Regards
Param
Gert Vanthienen wrote:
>
> L.S.,
>
> The exception indicates that the thread that was waiting for the sync
> exchange to come back somehow got interrupted. In ServiceMix itself,
> this will probably happen if you close the DeliveryChannel or the Flow
> that is carrying the exchange. Do you do anything like this in your
> test code? Or do you perhaps do any other thread manipulation in that
> code yourself?
>
> If this doesn't help you solve the problem, we might be able to help
> you better if you post the source code for the testing endpoint and/or
> the spring XML file that configures the endpoints.
>
> Regards,
>
> Gert Vanthienen
> ------------------------
> Open Source SOA: http://fusesource.com
> Blog: http://gertvanthienen.blogspot.com/
>
>
>
> 2009/3/23 smx_user <[email protected]>:
>>
>> Hello,
>>
>> Iam facing the problem while doing a sendsync. A messaging
>> exception(InterruptedException) is thrown with the following stacktrace
>>
>> javax.jbi.messaging.MessagingException: java.lang.InterruptedException
>> at
>> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.sendSync(DeliveryChannelImpl.java:508)
>> at
>> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.sendSync(DeliveryChannelImpl.java:442)
>> at
>> org.apache.servicemix.common.EndpointDeliveryChannel.sendSync(EndpointDeliveryChannel.java:95)
>> at test.JbiMsgSender.dosendsync(JbiMsgSender.java:82)
>> at
>> Caused by: java.lang.InterruptedException
>> at java.lang.Object.wait(Native Method)
>> at
>> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.waitForExchange(DeliveryChannelImpl.java:709)
>> at
>> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.sendSync(DeliveryChannelImpl.java:472)
>> ... 10 more
>>
>> where JbiMsgSender is my test class.
>>
>> Just to give background, I have a component which contains 2 provider
>> endpoints. Lets Name it
>>
>> ActualProviderEndpoint
>> TestingProviderEndpoint
>>
>> Now Actualprovider endpoint is making sendsync call to the other
>> component
>> in the JBI environment for consuming some service. Now for the testing
>> purpose of ActualProviderEndpoint, i have created the
>> TestingProviderEndpoint in the same component . In the spring.xml i have
>> configured the targetservice to be TestingProviderEndpoint for
>> ActualProviderEndpoint. I have created inout exchange and doing a
>> sendSync.
>> Now the exception is thrown @ waitForExchange method in
>> DeliveryChannelImpl.java:709.
>>
>> In actual JBI environment same code works, but only in the testing
>> environement this exception is thrown.
>>
>> Any clue to resolve this error? If there is better way to test the
>> provider
>> endpoint consuming a service via spring framework plzz let me know
>>
>> Thanks in advance
>> Param
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Problem-With-SendSync---InterruptedException%28Test-environment%29-tp22657797p22657797.html
>> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>>
>>
>
>
> -----
> ---
> Gert Vanthienen
> http://gertvanthienen.blogspot.com
>
--
View this message in context:
http://www.nabble.com/Problem-With-SendSync---InterruptedException%28Test-environment%29-tp22657797p22663872.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.