0

I am using WSO2 ESB 5.0.0 and Apache activeMQ 5.14 for my project.I am using jms proxy which is listening to a queue and the proxy is using jms message store to store the messages.And there is a message processor which will pick up those messages from that message store for further processing.

But after restarting WSO2 server the messages which were stuck at the queue are getting dequeued and vanished.

Is there any way to store those messages by WSO2?

Here is my proxy service:

<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
       name="abcMQ"
       startOnLoad="true"
       statistics="disable"
       trace="disable"
       transports="jms">
   <target>
      <inSequence>
         <log level="full" separator="**Consumed from abc IN Seq**"/>
         <property name="DISABLE_CHUNKING"
                   scope="axis2"
                   type="STRING"
                   value="true"/>
         <store messageStore="TEST"/>
      </inSequence>
      <outSequence>
         <send/>
      </outSequence>
      <faultSequence/>
   </target>
   <parameter name="transport.jms.Destination">req.Q</parameter>
   <parameter name="transport.jms.ContentType">application/XML</parameter>
   <description/>
</proxy>

The message store TEST is below:

<messageStore name="TEST" class="org.apache.synapse.message.store.impl.jms.JmsStore" xmlns="http://ws.apache.org/ns/synapse">
   <parameter name="java.naming.factory.initial">org.apache.activemq.jndi.ActiveMQInitialContextFactory</parameter>
   <parameter name="java.naming.provider.url">tcp://localhost:61616</parameter>
   <parameter name="store.jms.destination">TEST.Q</parameter>
   <parameter name="store.jms.username">admin</parameter>
   <parameter name="store.jms.password">admin</parameter>
   <parameter name="store.jms.JMSSpecVersion">1.1</parameter>
   <parameter name="store.producer.guaranteed.delivery.enable">true</parameter>
   <parameter name="store.failover.message.store.name">fail</parameter>
</messageStore>

The fail message store is:

<messageStore name="fail" class="org.apache.synapse.message.store.impl.jms.JmsStore" xmlns="http://ws.apache.org/ns/synapse">
   <parameter name="java.naming.factory.initial">org.apache.activemq.jndi.ActiveMQInitialContextFactory</parameter>
   <parameter name="java.naming.provider.url">tcp://localhost:61616</parameter>
   <parameter name="store.jms.destination">fail.Q</parameter>
   <parameter name="store.jms.username">admin</parameter>
   <parameter name="store.jms.password">admin</parameter>
   <parameter name="store.jms.JMSSpecVersion">1.1</parameter>
   <parameter name="store.producer.guaranteed.delivery.enable">false</parameter>
   <parameter name="store.failover.message.store.name">fail</parameter>
</messageStore>

Message processor is:

<messageProcessor name="TestProcessor" class="org.apache.synapse.message.processor.impl.sampler.SamplingProcessor" messageStore="TEST" xmlns="http://ws.apache.org/ns/synapse">
   <parameter name="interval">1000</parameter>
   <parameter name="concurrency">1</parameter>
   <parameter name="sequence">DemoSequence</parameter>
   <parameter name="is.active">true</parameter>
</messageProcessor>
halfer
  • 19,824
  • 17
  • 99
  • 186
Vivek Shah
  • 45
  • 5
  • try changing startonload to false and restart and do the same test and let me know the behavior – Muralidharan.rade Dec 14 '17 at 15:53
  • @Muralidharan.rade tried with changing startonload to false and restarted and done the same test.But got the same issue and the value of startonload also changed to true after restarting server. JMSMessageReceiver Unknown error processing message java.lang.NullPointerException at org.wso2.carbon.mediation.initializer.handler.ProxyLogHandler.handleLogAppenderSetter(ProxyLogHandler.java:41) at org.wso2.carbon.mediation.initializer.handler.ProxyLogHandler.handleRequestInFlow(ProxyLogHandler.java:14) – Vivek Shah Dec 15 '17 at 11:38
  • I suppose this is a known issue with startonload. https://stackoverflow.com/questions/46353468/startonload-is-not-working-as-expeceted But for ur original issue, try to deactivate the proxy and start after the restart and should not face this issue.. – Muralidharan.rade Dec 15 '17 at 11:46

1 Answers1

0

Since the in-memory message stores uses an in-memory queue to store the messages, the messages will be lost in case of a restart or shutdown.

That's why its use is not recommended for Production systems or large scale message processing systems. You can view the recommendation here.

Consider using other forms of message stores for better reliability and guaranteed delivery. Refer the following options: https://docs.wso2.com/display/ESB500/Adding+a+Message+Store

Also consider using a fail-over message store for better reliability. https://docs.wso2.com/display/ESB500/Guaranteed+Delivery+with+Failover+Message+Store+and+Scheduled+Failover+Message+Forwarding+Processor

Muralidharan.rade
  • 2,226
  • 1
  • 24
  • 34
  • I also tried with JMS message store as below:-- Created a jms message store in the proxy service and again added a sampling message processor to pick those messages from the queue for further processing. Then I stopped WSO2 server for a while and added some messages into the queue(req.Q) which is listening by wso2 jms proxy. But after starting the wso2 server,the messages are dequeued from the queue (req.Q) and in wso2 logs i have seen null pointer exception. Also I did not see any messages at the queue where the messages are getting added by the jms message store. WHY??? – Vivek Shah Dec 12 '17 at 05:58
  • ERROR - JMSMessageReceiver Unknown error processing message java.lang.NullPointerException – Vivek Shah Dec 13 '17 at 08:35
  • @VivekShah error stack trace would be helpful to understand the real issue, not a one liner. – Muralidharan.rade Dec 13 '17 at 11:19
  • ERROR - JMSMessageReceiver Unknown error processing message java.lang.NullPointerException at org.wso2.carbon.mediation.initializer.handler.ProxyLogHandler.handleLogAppenderSetter(ProxyLogHandler.java:41) at org.wso2.carbon.mediation.initializer.handler.ProxyLogHandler.handleRequestInFlow(ProxyLogHandler.java:14) at org.apache.synapse.core.axis2.ProxyServiceMessageReceiver.receive(ProxyServiceMessageReceiver.java:167) at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180) – Vivek Shah Dec 13 '17 at 13:32
  • Looks like the messages are getting processed even before all the components are initialized. The exception is probably because the proxy service is not available or not properly initialized. Enable debug mode and analyze and also share the code of the services that you use. – Muralidharan.rade Dec 13 '17 at 16:09
  • I have added a snippet of my code and updated the question as well.plz have a look and suggest me what should I do to solve this issue – Vivek Shah Dec 14 '17 at 06:39