activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GaryG <>
Subject Re: Queue question
Date Fri, 02 Feb 2007 21:15:22 GMT

Thanks for the clarification.

While poking around with JConsole connecting to the broker via JMX I found
the option to purge Queues.  And after tweaking with the code a bit, came up
with the following piece of code that actually *does* purge a queue.

Has anyone used this approach before and are there any reason not to do this
on Q's?  (ie. use Topics instead).  It just feels odd to be using topics
when the communication is known to be P2P.

JMXServiceURL u = new
JMXConnector c = JMXConnectorFactory.connect(u);


ObjectName objName = new
+ qName);

c.getMBeanServerConnection().invoke(objName, "purge", null, null);
System.out.println("invoked purge command on Q = " + qName);


James.Strachan wrote:
> Persistence v non persistence only applies to what happens to messages
> if you reboot the broker; otherwise the semantics are pretty similar.
> If you don't want a message to be sent to consumers which are not
> there, don't use a queue, use a topic.
> On 2/1/07, GaryG <> wrote:
>> I'm doing some simple communication between two peers via a Queue, and
>> I'm
>> noticing odd persistence behavior.
>> Even though both the producer is set with DeliveryMode.NON_PERSISTENT,
>> what
>> I see happen is this:
>> 1) Bring up AMQ broker
>> 2) Bring up Producer and send 5 test messages.  At this point the
>> consumer
>> of the messages for this Q is not even running.
>> 3) Bing up Consumer and it receive the 5 messages.
>> I've tried setting TTL on the Producer to something really short, but
>> that
>> didn't help.
>> This seems wrong to me, as I would only expect the messages to be
>> delivered
>> to the consumer of the Q if the consumer was A) actually running, or B)
>> there was persistence turned on.
>> If I use a Topic instead, the above scenario works as expected, and I
>> only
>> get the missed messages if I turn on persistence.
>> What am I missing?
>> Perhaps I'm not grasping what persistence is and how it should work?  I
>> understand the messages persisted to a DB for backup, how is that
>> different
>> from journaling?  If I want delivery assurance, even if a consumer is
>> down,
>> do I have to turn on DeliveryMode.PERSISTENT on the producer, AND use a
>> DurableSubscriber on the consumer end?
>> I appreciate any help!
>> -GaryG
>> --
>> View this message in context:
>> Sent from the ActiveMQ - User mailing list archive at
> -- 
> James
> -------

View this message in context:
Sent from the ActiveMQ - User mailing list archive at

View raw message