0

So I am using HonetQ on Jboss but I ran into an issue. Right now, if the jms messages arrive to our queues and suddendly there is a crash or a restart all our messages will be lost. I have read about enabling persitence on the queues but as I saw this parameter defaults to true. I have read several questions from other user like "where you using persistence ?" and "was persistence enabled?". What exactly is this persistence they refer to ? At queue level ? Or is there a higher level like a Hornet/Jboss configuration ?

Hope you can help !

Gab
  • 7,869
  • 4
  • 37
  • 68

2 Answers2

2

on jboss hornetQ is configured in the messaging domain of jboss configuration (standalone/domain.xml)

 <subsystem xmlns="urn:jboss:domain:messaging:1.1">
        <hornetq-server>
            <persistence-enabled>true</persistence-enabled>
            [...]

you can also set it on the message itself while posting it

messageProducer.send(objectMessage, DeliveryMode.PERSISTENT, priority, timeToLive);

also be sure that the queue is not configured with durable flag to false

<jms-queue name="myQueueName">
     <entry name="queue/myQueueName"/>
     <entry name="java:jboss/exported/jms/queue/myQueueName"/>
</jms-queue>

see What is the meaning of 'durable' attribute for JMS Queue in JBoss 7 with HornetQ?

Community
  • 1
  • 1
Gab
  • 7,869
  • 4
  • 37
  • 68
  • The advice regarding the queue I already have it, and so do I on the standalone.xml. I will try to set it on the message. Any other idea ? The message keep disappearing from the queue on restart – yourAverageDeveloper Jul 07 '15 at 14:11
  • maybe you're cleaning the data/messagingjournal directory ? How do you know that the message disappeared from the queue ? are you sure that it's not in 'in delivery' status? – Gab Jul 07 '15 at 14:14
  • I am consulting the queue data through management console of jboss. There I can see the message count as 1 or whatever and then after restart it is back on 0. how can I verify the "on delivery" ? – yourAverageDeveloper Jul 07 '15 at 14:22
  • actually the field that increments and then goes back to 0 is "messages-added" on the data from the queue – yourAverageDeveloper Jul 07 '15 at 14:29
  • 1
    yes it's normal, queue is re-created on server startup and message-added is so 0. your message should be either in message-count (currently in the queue) or deliveringCount (currently in delivery). For the delivery counter, note that consumers may fetch many message at a time (according to the consumer-windows-size parameter) – Gab Jul 07 '15 at 14:42
  • What you say makes sense but for some reason message-count was and remains 4, deliveringCount 0 and remains and the message-added was 1 and resetted to 0. Is there any limit on the message count that could be set to 4 ? – yourAverageDeveloper Jul 07 '15 at 14:52
  • not on the message count itself but on the queue size (address-setting/max-size-bytes) – Gab Jul 07 '15 at 15:06
  • Thanks a lot for you help. It was exactly what you suggested, only needed to ensure the persistence was enabled on the queues individually. I was testing it wrongly ! – yourAverageDeveloper Jul 07 '15 at 17:17
1

HornetQ persistance is configured with the persistence-enabled parameter in the the hornetq-configuration.xml. It should default to true, but maybe setting it explicitely will solve your issue.

Read more about it here.

Fritz Duchardt
  • 11,026
  • 4
  • 41
  • 60