Tuesday, June 11, 2013

How to monitor WSO2 ESB mediation statistics from WSO2 BAM

With this blog post you can setup WSO2 BAM with ESB to monitor statistics.

How to enable auto reconnection in WSO2 ESB with ActiveMQ


If you followed my previous blog post, I guess you will be able to setup WSO2 ESB with ActiveMQ within few minutes.
Either you configured perfectly and messages communicated perfectly, if ActiveMQ goes stop or restarted, ESB console will print bunch of exceptions. Because ESB always connected with the respective JMS queues or topics with the JMS broker and once connection breaks ESB prints exceptions.

 [2013-06-11 15:10:21,815] ERROR - ServiceTaskManager Error receiving message for service : Sample_Proxy  
 javax.jms.JMSException: java.io.EOFException  
      at org.apache.activemq.util.JMSExceptionSupport.create(JMSExceptionSupport.java:62)  
      at org.apache.activemq.ActiveMQMessageConsumer.dequeue(ActiveMQMessageConsumer.java:476)  
      at org.apache.activemq.ActiveMQMessageConsumer.receive(ActiveMQMessageConsumer.java:594)  
      at org.apache.axis2.transport.jms.ServiceTaskManager$MessageListenerTask.receiveMessage(ServiceTaskManager.java:513)  
      at org.apache.axis2.transport.jms.ServiceTaskManager$MessageListenerTask.run(ServiceTaskManager.java:420)  
      at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172)  
      at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)  
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)  
      at java.lang.Thread.run(Thread.java:662)  
 Caused by: java.io.EOFException  
      at java.io.DataInputStream.readInt(DataInputStream.java:375)  
      at org.apache.activemq.openwire.OpenWireFormat.unmarshal(OpenWireFormat.java:275)  
      at org.apache.activemq.transport.tcp.TcpTransport.readCommand(TcpTransport.java:229)  
      at org.apache.activemq.transport.tcp.TcpTransport.doRun(TcpTransport.java:221)  
      at org.apache.activemq.transport.tcp.TcpTransport.run(TcpTransport.java:204)  
      ... 1 more  

"transport.jms.CacheLevel" is the parameter which used to reconnect to the broker in case of failure.This parameter need to be configured in each and every connection factories under JMS sender configurations.
To configure it, open axis2.xml located in  ESB_HOME/repository/conf/axis2/axist.xml". add "transport.jms.CacheLevel" parameter as follows.




Once ESB work with the parameter, Either broker goes failed or restarted you will see ESB console print reconnection messages like below.

 [2013-06-11 16:19:49,116] ERROR - ServiceTaskManager Reconnection attempt : 5 for service : Sample_Proxy failed. Next retry in 320 seconds  
 [2013-06-11 16:25:09,118] INFO - ServiceTaskManager Reconnection attempt : 6 for service : Sample_Proxy  
 [2013-06-11 16:25:09,119] INFO - ServiceTaskManager Task manager for service : Sample_Proxy [re-]initialized  
 [2013-06-11 16:25:10,119] INFO - ServiceTaskManager Reconnection attempt: 6 for service: Sample_Proxy was successful!  


Monday, June 10, 2013

How to Configure ActiveMQ with WSO2 ESB 4.6.0 within TWO MINUTES

WSO2 ESB is allows to work with the JMS transport to send and receive messages to queues and topics of any JMS services. WSO2 ESB capable to work with multiple broker services such as,
  • WSO2 Message Broker
  • Active MQ
  • IBM WebSphere MQ
  • IBM WebSphere  Application Server
  • MSMQ
  • Tibco EMS
  • SwiftMQ

Hence many users trying to use WSO2 ESB with ActiveMQ this blog post will demonstrate how to configure ActiveMQ with ESB within 2 minutes.I am using ActiveMQ 5.5.1 and ESB 4.6.0.

        1. Download ActiveMQ from here. 
        2. Download WSO2 ESB from here.

        3. Extract "apache-activemq-5.5.1" open ACTIVEMQ_HOME/lib directory and copy below jars.  
   
  • activemq-core-5.5.1.jar
  • geronimo-j2ee-management_1.0_spec-1.0.jar
  • geronimo-jms_1.1_spec-1.1.1.jar


    NOTE :  If you are using ActiveMQ 5.5.8 distribution, there's no activemq-core-5.5.1.jar in lib directory. Please copy following jars.

    • activemq-broker-5.8.0 
    • activemq-client-5.8.0 
    • geronimo-j2ee-management_1.1_spec-1.0.1 
    • geronimo-jms_1.1_spec-1.1.1 

    4. Extract ESB distribution and copy above AvtiveMQ related jars in to the "ESB_HOME/repository/components/lib" directory. 

    5. Now JMS listner and JMS sender need to be enabled in ESB distribution to serve with the ActiveMQ message Broker. To Do that open "axis2.xml" located in "ESB_HOME/repository/conf/axis2"location.

    6. Uncomment JMS listener configurations as follows. we are enabling In Queue connection factory, Topic connection factory and default to listen JMS messages. How these 3 are work is if ESB has proxy service and in that proxy specifically mention proxy type to the JMS Queue it is using Queue connection factory. If proxy type mention topic,it uses topic connection factory. If there are nothing in proxy type it uses "default" but most of the times default also point to the JMS queue. 





    7. Now Uncomment lelow line from axis2.xml to enable JMS sender.



      
    8. Now start ActiveMQ broker. To do that open ActiveMQ_Home/bin and run activemq script as a "./ active start" command. Once you started successfully you will see ActiveMQ web console from "http://localhost:8161/admin/index.jsp"

    9. Finally start ESB server and send messages from ActiveMQ queue to ESB.




Friday, March 29, 2013

How to deactivate monitor sleep in Raspbery Pi

This is my personal experience. I have installed "Raspbery Pi Wheezy" in to my raspberry pi. I used it to display some browser based dashboard and it going to sleep mode frequently. i found this solution from one of the site i couldn't' remember what it is. Following was the solution what i have used to avoid this issue. It's worked perfect.

1. Open a root terminal in raspberry Pi. Now  you need to edit your script that's starting X. In the default build with lightdm.
2. Open "lightdm.conf" file located in, 

     /etc/lightdm/lightdm.conf

3. Add below line in to SeatDefault section.
[SeatDefaults]
xserver-command=X -s 0 -dpms
4. Restart your Raspberry Pi.
Now issue should be solved.

Friday, March 22, 2013

How to connect WSO2 ESB with ActiveMQ

This article will describes how to configure WSO2 ESB 4.6.0 to work with the JMS transport. WSO2 ESB can work as a JMS listener or sender. It will works with the various types of JMS brokers such as,
1. ActiveMQ
2. IBM MQ
3. Websphere MQ
4. MSMQ
5. SwiftMQ
6. Tibco EMS
7. WSO2 Message Broker

To demonstrate this article i am using ActiveMQ Broker. You can download ActiveMQ 5.5.1 from here.  To Work with that download WSO2 ESB from here.

Start ActiveMQ

1. Extract downloaded ActiveMQ,
     In linux : tar zxvf apache-activemq-5.5.1-bin.tar.gz