Thursday, September 18, 2014

Configuring WSO2 ESB with MB for Guaranteed Delivery


In this post i'm going to discuss about how to configure WSO2 ESB and MB for Guranteed deleivery. In my previous post I have discussed similar implementation using activeMQ. I recommend to read that for detailed instruction since i'm going to make this very brief.

ESB Configurations

Add required jars
Copy and paste following jars from WSO2MB/clent-lib folder to ESB/repository/components/lib folder.
andes-client-0.13.wso2v4
geronimo-jms_1.1_spec-1.1.0.wso2v1

Enable the jms transports in axis2.xml for MB
Open the /repository/conf/axis2/axis2.xml with a text editor. 

  • Uncomment the xml config below the '!--Uncomment this and configure as appropriate for JMS transport support with WSO2 MB 2.x.x --'
  • Uncomment the line below '!-- uncomment this and configure to use connection pools for sending messages'


Edit jndi.ptoperties
Open /repository/conf/jndi.properties with a text editor and edit it as it has following config

# register some connection factories
# connectionfactory.[jndiname] = [ConnectionURL]
connectionfactory.QueueConnectionFactory = amqp://admin:admin@clientID/carbon?brokerlist='tcp://localhost:5673'
connectionfactory.TopicConnectionFactory = amqp://admin:admin@clientID/carbon?brokerlist='tcp://localhost:5673'

# register some queues in JNDI using the form
# queue.[jndiName] = [physicalName]
queue.JMSMS_MB=JMSMS_MB

# register some topics in JNDI using the form
# topic.[jndiName] = [physicalName]
topic.MyTopic = myTopic


Create a proxy service, message-store and message-processor in ESB.
You can use the following code


 
   
      
org.wso2.andes.jndi.PropertiesFileInitialContextFactory repository/conf/jndi.properties JMSMSMB 1000 1000 true


Start backend service (refer the previous blog)

Start WSO2 MB
go to WSO2MB/bin and use the command ./wso2server.sh

Start ESB and copy paste the above configuration in source view.


Test

Invoke the sampleProxy using tryit tool, observe the backend services terminal and you would see something like follows
samples.services.SimpleStockQuoteService :: Generating quote for : APPLE
Observe the web console of MB, 
Goto the management console of MB and click on the Browse button under Queue you would see something like follows


You may see the queue named JSMMSMB is created there. And you may see the message count is zero. 


Shutdown the backend service and test again, 

You will see errors in ESB terminal like follows

ERROR - BlockingMsgSender Error sending Message to url : http://localhost:9000/services/SimpleStockQuoteService
org.apache.axis2.AxisFault: Connection refused

Observe the WSO2 MBs queue.
Goto the management console of MB and click on the Browse button under Queue you may see the queue named JSMMSMB is created there. And you may see the message count is one.

Then start the backend service again
You will see on backend service's console that it rreceived the messages.
Also look at the MB's web console and refresh the page, you will see that message count is now equal to zero again. That is there are no messages that it did not deliver.

This concludes the guaranteed delivery demonstration.







No comments: