7 Replies Latest reply on Mar 23, 2010 4:29 AM by Luke McLean

    Queue persistence

    Luke McLean Newbie

      Gidday,

       

      I am using HornetQ 2.0.0GA in conjunction with Mule 2.2.1 (I'm on Windoze) and things are going along great... that was until today.

       

      Messages don't appear to survive a restart of the HornetQ server. I'm simply using the standalone or clustered default configurations (tried both, not running at same time).  I use Mule can send a few messages to the queue. I can use jconsole (JMX) locally to see the queue and confirm that the messages arrive OK. They do. I can stop Mule and restart Mule and voila! it reconnects and consumes the messages.

       

      I now set Mule not to consume the messages and create a few messages on the queue. Using Jconsole I can see the queue and the messages sitting there. Now I stop the HornetQ server. Restart the server and the queue is empty? I must be a bit thick because I'm sure that the User Manual states that these queues are persisted by default. What am I missing... as the point of using JMS is so that messages are not lost.

       

      Must be something simple but I've read everything I can find and this behaviour has me baffled.

       

      Thank you.

        • 1. Re: Queue persistence
          Tim Fox Master

          Yes, of course persistent messages are persisted.

           

          Please post a simple test program that replicates the issue and someone will take a look.

          • 2. Re: Queue persistence
            Luke McLean Newbie

            Thanks Tim,

             

            I don't think that the Mule side of things is relevant because I see the messages in the queue before I restart.  I didn't consider the changes I made to HornetQ significant enough to have any effect.  I'll just show what I've changed in the hornetq-jms.xml configuration. I just placed the 'import' queue in the file, like so...

             

            <configuration xmlns="urn:hornetq"
                       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                       xsi:schemaLocation="urn:hornetq /schema/hornetq-jms.xsd">
               
                <connection-factory name="NettyConnectionFactory">
                   <connectors>
                     <connector-ref connector-name="netty"/>
                   </connectors>
                    <entries>
                        <entry name="/ConnectionFactory"/>
                        <entry name="/XAConnectionFactory"/>
                    </entries>
                </connection-factory>
               
                <queue name="DLQ">
                    <entry name="/queue/DLQ"/>
                </queue>
                <queue name="import">
                    <entry name="/queue/import"/>
                </queue>
                <queue name="ExpiryQueue">
                    <entry name="/queue/ExpiryQueue"/>
                </queue>  
                <queue name="ExampleQueue">
                    <entry name="/queue/ExampleQueue"/>
                </queue>
                <topic name="ExampleTopic">
                    <entry name="/topic/ExampleTopic"/>
                </topic>
               
            </configuration>

             

            That is all I did. I changed the run.bat file to start the clustered configuration (when standalone didn't work).

             

            To replicate I just send some messages to the queue. They are there and I see them in Jconsole (screenshot 1). I stop the server and restart and they are gone (screenshot 2). I have replicated this same thing on three different machines so far and that is why I think that I must be missing something.  I'm on Windoze, (Tested on both Server2003, XP Prof). I looked at the journal files just now and their timestamps have not updated since I started at 6pm (now it's 9pm here in NZ)... is that unusual?

            • 3. Re: Queue persistence
              Tim Fox Master

              You still need to post your code (that sends your messages). For all I know you are sending them as non persistent.

              1 of 1 people found this helpful
              • 4. Re: Queue persistence
                Luke McLean Newbie

                OK Tim, quite right. Mule configuration (all configuration and no added code for this test). Good lead...I'll check the mule transport for other attributes in case the default is non-persistent.

                 

                <?xml version="1.0" encoding="UTF-8"?>
                <mule xmlns="http://www.mulesource.org/schema/mule/core/2.2"
                       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                       xmlns:spring="http://www.springframework.org/schema/beans"
                       xmlns:stdio="http://www.mulesource.org/schema/mule/stdio/2.2"
                       xmlns:vm="http://www.mulesource.org/schema/mule/vm/2.2"
                       xmlns:jms="http://www.mulesource.org/schema/mule/jms/2.2"
                       xmlns:quartz="http://www.mulesource.org/schema/mule/quartz/2.2"
                    xsi:schemaLocation="
                       http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
                       http://www.mulesource.org/schema/mule/core/2.2 http://www.mulesource.org/schema/mule/core/2.2/mule.xsd
                       http://www.mulesource.org/schema/mule/stdio/2.2 http://www.mulesource.org/schema/mule/stdio/2.2/mule-stdio.xsd
                       http://www.mulesource.org/schema/mule/vm/2.2 http://www.mulesource.org/schema/mule/vm/2.2/mule-vm.xsd
                       http://www.mulesource.org/schema/mule/jms/2.2 http://www.mulesource.org/schema/mule/jms/2.2/mule-jms.xsd
                       http://www.mulesource.org/schema/mule/quartz/2.2 http://www.mulesource.org/schema/mule/quartz/2.2/mule-quartz.xsd">
                   
                    <stdio:connector name="stdioConnector" promptMessage="Please enter message: "  outputMessage="Received message: " messageDelayTime="10"/>
                     <spring:bean name="transportConfiguration" > 
                     <spring:constructor-arg  value="org.hornetq.integration.transports.netty.NettyConnectorFactory"/> 
                </spring:bean> 
                  
                <spring:bean name="connectionFactory" > 
                    <spring:constructor-arg ref="transportConfiguration"/> 
                    <spring:property name="cacheLargeMessagesClient" value="false"/> 
                <!--    <spring:property name="discoveryAddress" value="231.7.7.7"/>
                    <spring:property name="discoveryPort" value="9876"/>
                -->
                </spring:bean> 
                  
                <jms:connector name="jmsConnector" 
                                connectionFactory-ref="connectionFactory" 
                                createMultipleTransactedReceivers="true" 
                                numberOfConcurrentTransactedReceivers="10" 
                                 specification="1.1"> 
                </jms:connector>

                 

                    <jms:object-to-jmsmessage-transformer name="ObjectToJMSMessageTransformer"/>
                    <jms:jmsmessage-to-object-transformer name="JMSMessageToObjectTransformer"/>

                 

                    <model>

                 

                        <service name="stdioToQueue">
                            <inbound>
                                <stdio:inbound-endpoint system="IN"/>
                            </inbound>
                            <outbound>
                                <pass-through-router>
                                    <jms:outbound-endpoint queue="import"/>
                                </pass-through-router>
                            </outbound>
                        </service>

                 

                    </model>

                 

                </mule>

                • 5. Re: Queue persistence
                  Tim Fox Master

                  One thing that might help.

                   

                  When you view your messages in jconsole, you should be able to see whether they are durable or not (it's an attribute on the message).

                   

                  Also take a look whether your queue is durable, this can be done via JMX too. Durable messages in a non durable queue will behave as non durable.

                  • 6. Re: Queue persistence
                    Luke McLean Newbie

                    Hey Tim, could you please glance your eye over http://www.mulesoft.org/display/MULE2USER/JMS+Transport

                     

                    There is nothing specific to HornetQ yet but I'm guessing that the default persistentDelivery might be false. I'll set to true and see what happens. Would be good to update the Mule dudes.

                    • 7. Re: Queue persistence
                      Luke McLean Newbie

                      Tim, YOU THE MAN!

                       

                      Without persistentDelivery set (must be default false)

                       

                      {MULE_SESSION=SUQ9ZThmZDJiYWYtMzY1NS0xMWRmLTk2MTYtODk4OThiMDIzZjFm, JMSCorrelationID=e8fd2bae-3655-11df-9616-89898b023f1f, JMSExpiration=0, JMSMessageID=ID:e8fd2bc1-3655-11df-945b-0015c507a7c8:0000000000000000, address=jms.queue.import, JMSDeliveryMode=NON_PERSISTENT, MULE_ENCODING=UTF-8, MULE_CORRELATION_ID=e8fd2bae-3655-11df-9616-89898b023f1f, JMSPriority=4, MULE_ENDPOINT=jms://import, MULE_ORIGINATING_ENDPOINT=endpoint.stdio.system.in, JMSTimestamp=1269332845343}

                       

                      With persistentDelivery=true

                      {MULE_SESSION=SUQ9NDQ5YzU0MjItMzY1NS0xMWRmLWJmODMtZjE5ODgxNWExNjNk, JMSCorrelationID=449c5421-3655-11df-bf83-f198815a163d, JMSExpiration=0, JMSMessageID=ID:44a38076-3655-11df-8c4a-0015c507a7c8:0000000000000000, address=jms.queue.import, JMSDeliveryMode=PERSISTENT, MULE_ENCODING=UTF-8, MULE_CORRELATION_ID=449c5421-3655-11df-bf83-f198815a163d, JMSPriority=4, MULE_ENDPOINT=jms://import, MULE_ORIGINATING_ENDPOINT=endpoint.stdio.system.in, JMSTimestamp=1269332569640}

                       

                      One happy man here!

                       

                      Thanks mate.