-
1. Re: ServiceInvoker -- deliverAsync question ?
rkapur123 Apr 30, 2009 5:16 PM (in response to rkapur123)It is such a good feeling when things work and sometimes its like "oh yeah - that's exactly it."
Lots of thanks to my colleague - who helped figured out.private void sendAsync() { try { System.setProperty("javax.xml.registry.ConnectionFactoryClass", "org.apache.ws.scout.registry.ConnectionFactoryImpl"); ServiceInvoker invoker = new ServiceInvoker("FirstServiceESB", "SimpleListener"); Message requestMessage = MessageFactory.getInstance().getMessage(); requestMessage.getBody().add("hello world."); requestMessage.getProperties().setProperty("name", "testMessage"); Properties props = new Properties(); props.put("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory"); props.put("java.naming.provider.url", "jnp://localhost:1099"); props.put("java.naming.factory.url.pkgs", "org.jnp.interfaces"); JMSEpr replyToEPR = new JMSEpr("1.1", "queue", "quickstart_helloworld_Request_esb", "ConnectionFactory", props, "name='testMessage'"); TwoWayCourier twoWayCourier = CourierFactory .getPickupCourier(replyToEPR); requestMessage.getHeader().getCall().setReplyTo(replyToEPR); invoker.deliverAsync(requestMessage); Message responseMessage = twoWayCourier.pickup(60000); System.out.println(responseMessage.getBody().get().toString()); } catch (Exception e) { e.printStackTrace(); } }
-
2. Re: ServiceInvoker -- deliverAsync question ?
tfennelly May 1, 2009 5:14 AM (in response to rkapur123)This is effectively what ServiceInvoker.deliverSync does. Why did that not work, or did you simply miss it?
-
3. Re: ServiceInvoker -- deliverAsync question ?
rkapur123 May 1, 2009 11:09 AM (in response to rkapur123)yes, I should have probably open source code for Sync method. But the requirement was to demonstrate both mechanism.
yes, I think I simply missed the details in documentation. thanks anyways
kind regards -- rishi -
4. Re: ServiceInvoker -- deliverAsync question ?
kconner May 11, 2009 6:16 AM (in response to rkapur123)Bit this does not demonstrate async behaviour as the intent with async is to allow processing to occur at a later time and on a different thread. This frees resources (threads etc), works well with transactions and scales much better than synchronous calls.
As Tom says, all you have done is duplicate the sync behaviour.