Search code examples
wso2activemq-classicwso2-data-services-serverwso2-esb

How We can Store JMS Persistence in DIsk Using Wso2


I am Using Wso2ESB 4.7.0 And ActiveMQ or WSo2message borker 2.1.0

<proxy xmlns="http://ws.apache.org/ns/synapse" name="Message" transports="https,http" statistics="disable" trace="disable" startOnLoad="true">
   <target>
      <inSequence>
         <log level="full"/>
         <property name="faisal" value="faisal" scope="default" type="STRING"/>
         <property name="target.endpoint" value="JmsChecking" scope="default" type="STRING"/>
         <store messageStore="faisal5"/>
      </inSequence>
      <outSequence>
         <log level="full"/>
      </outSequence>
   </target>
   <description></description>
</proxy

i wish store my messages in my system disk how we can provide a manual store to any Message stor

e like active mq or mwso2 message broker
    <messageStore name="faisal5" class="org.wso2.carbon.message.store.persistence.jms.JMSMessageStore" 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">faisal5_Queue</parameter>
       <parameter name="store.jms.JMSSpecVersion">1.1</parameter>
       <parameter name="store.jms.cache.connection">false</parameter>
    </messageStore>

and message process config is like this is it possible to store a failure messages into system disk .if server crashes my data is lost how can i achieve it


Solution

  • Did you try enabling persistence in ActiveMQ? Which version of ActiveMQ do you use? I looked in to ActiveMQ 5.8 and it uses KahaDB which is a file based DB as the default persistence configuration. The persistence approach can be changed based on you requirement.

    To enable persistance;

    1) Go to file [ActiveMQ_HOME] --> conf --> activemq.xml

    2) Check if below configurations are enabled for broker;

    <broker xmlns="http://activemq.apache.org/schema/core" brokerName="localhost" persistent="true" dataDirectory="${activemq.data}">
        <persistenceAdapter>
            <kahaDB directory="${activemq.data}/kahadb"/>
        </persistenceAdapter>
    

    • Within broker tag, attribute set to persistent="true".
    • configurations are pointing to KahaDB.

    The default KahaDB files can be found under the below location;

    [ActiveMQ_HOME]/data/kahadb/

    Check if this satisfies your requirement. For more information, please refer ActiveMQ Persistence. The latter part contains KahaDB persistence configurations.

    BTW in ActiveMQ console, what is refered to as "Messages Enqueued" is the count since last reset. This will set to 0 whenever you restart the server. The actual available message count is shown by the count under "Number Of Pending Messages".

    I haven't tried this with WSO2 MB. Will try it sometime and keep you posted.