This discussion is archived
8 Replies Latest reply: Sep 16, 2011 8:27 AM by 850110 RSS

persistent queues are not always created after first installation

850110 Newbie
Currently Being Moderated
I am using glassfish 2 and OpenMQ 4.3.

I am using cluster profile. I am using ant script to do the installation.

<exec executable="./asadmin" dir="glassfish/bin">
<arg line="create-cluster"/>
<arg line="--echo"/>
<arg line="--user ${sges.domain.user}"/>
<arg line="--passwordfile ${foundation.home-dir}/${sges.home-dir}/bin/password.txt"/>
<arg line="--host ${sges.host}"/>
<arg line="--port ${sges.port}"/>
<arg line="--secure"/>
<arg line="${sges.cluster-name}"/>
</exec>
<exec executable="./asadmin" dir="${foundation.home-dir}/${sges.home-dir}/bin">
<arg line="set"/>
<arg line="--echo"/>
<arg line="--user ${sges.domain.user}"/>
<arg line="--passwordfile ${foundation.home-dir}/${sges.home-dir}/bin/password.txt"/>
<arg line="--host ${sges.host}"/>
<arg line="--port ${sges.port}"/>
<arg line="--secure"/>
<arg line="${sges.cluster-name}-config.jms-service.start-args=&quot;-Dimq.autocreate.queue=false -Dimq.autocreate.topic=false&quot;"/>
</exec>


In the first ant "exec" I create the glassfish cluster, and in the second I set the "-Dimq.autocreate.queue=false -Dimq.autocreate.topic=false" to make sure that persistent queues are created. But, it does not create persistent queue at first install. I have to try multiple times before persistent queues are created. Is there any race condition there as well ?

Thanks
Vineet
  • 1. Re: persistent queues are not always created after first installation
    nigeldeakin Explorer
    Currently Being Moderated
    There's no such thing as a "persistent queue". Message are persistent or non-persistent. The term "persistent" does not apply to queues. Because of this, I don't understand your question.

    In MQ, setting the broker property imq.autocreate.queue to false means that you will need to create a queue using the "asadmin create-jmsdest" command before you can send messages to it. if you leave this property to its default value of true then a queue will be created automatically when the first message is sent to it.

    Are you seeing different behaviour?

    Nigel
  • 2. Re: persistent queues are not always created after first installation
    850110 Newbie
    Currently Being Moderated
    OK... Sorry for the confusion

    I meant persistent messages, specifically file-based persistence. I was seeing the behavior where restart of a cluster will lose the message in the queue. That behavior fits with the auto created queues and topic. So, I was trying to disable that. Once I set the imq.autocreate.queue='false', and create the queues manually, I was seeing the messages being stored in file under .../fs370/messages/QTestQueue/vrfile , but it takes 2 to 3 attempts to actually see the text file being created under /fs370/messages directory.

    I was wondering what was the reason for messages not being persistent every time.

    Let me know if it makes sense.

    Thanks
    Vineet
  • 3. Re: persistent queues are not always created after first installation
    nigeldeakin Explorer
    Currently Being Moderated
    I meant persistent messages, specifically file-based persistence. I was seeing the behavior where restart of a cluster will lose the message in the queue.
    That behavior fits with the auto created queues and topic.
    If you send a persistent message to a queue it should be written to the message store. The message should survive any subsequent broker or cluster restart. It makes no difference whether the queue was auto-created or created using administrative commands.

    Which OS are you using? Are you using disk write caching?

    Nigel
  • 4. Re: persistent queues are not always created after first installation
    850110 Newbie
    Currently Being Moderated
    I am sending persistent messages. But I don't see it being written to file everytime. Only after multiple installations, I see it getting written to file.

    I am using Red hat 5 (2.6.18-194.11.4.el5 #1 SMP Tue Sep 21 05:04:09 EDT 2010 x86_64 x86_64 x86_64 GNU/Linux)

    I haven't figured out a way to check if the write-cache is enabled or not. But in either case, it should atleast write the messages to the file at the time of shutting down the cluster .

    I upgraded from glassfish 2.1 to 2.1.1, since it comes with MQ 4.4.



    Vineet

    Edited by: vineet on May 5, 2011 12:39 AM
  • 5. Re: persistent queues are not always created after first installation
    nigeldeakin Explorer
    Currently Being Moderated
    Can you be more specific about what you are doing? How are you restarting the cluster? Are you only looking at the files in the message store, or are you trying to consume messages from the queue?

    Nigel
  • 6. Re: persistent queues are not always created after first installation
    850110 Newbie
    Currently Being Moderated
    I am using ant scripts to install glassfish, create cluster, create resources, like queues and topics

    It's a typical set up. I send persistent messages to a topic in JMS broker through Stateless bean. I have a 'routing' MDB which reads the message from topic and based on message header writes it to one of the queues. I have a consumer stateless bean, which reads message from these queues.

    Once I send few messages to the broker, I check if it is persistent by restarting the cluster through Admin Console. But restarting the cluster causes all the message in Broker to be lost.

    Vineet
  • 7. Re: persistent queues are not always created after first installation
    ak Explorer
    Currently Being Moderated
    Before you sending persistent messages to the topic, make sure the MDB is ready listening on the topic and the MDB should be durable subscriber in order to have unconsumed messages routed to it to survive broker restart for persistent topic messages will not be persisted by MQ unless there is a durable subscriber for it; and make sure you are sending persistent messages to the queues, and in your test, you need to be able to tell whether messages in the queues had already been consumed by your consumer stateless bean.
  • 8. Re: persistent queues are not always created after first installation
    850110 Newbie
    Currently Being Moderated
    The producer in this case was stateless bean, which was reading a resource value 'persist' to send the message as producer. The value was being used from annotaion @Resource(name="persist"). For some reason, it was not always being read correctly.

    I changed to read the value through context lookup. That works now !

    Thanks for the help.

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points