Not really doing anything fancy... just calling send many times: persistent =
false...

public void send(String name, DESTINATION_TYPE destination_type, Destination
reply_to, MessageIntf wrapper, boolean persistent) throws Exception {
                Destination dest = createDestination(name, destination_type);
                MessageProducer publisher = getProducer(dest, persistent);
                          
                          //wrapper.generateXMLMessage() just generates some
XML message.
                TextMessage msg =
_session.createTextMessage(wrapper.generateXMLMessage());
                msg.setJMSReplyTo(reply_to);
                log.debug(this.getClass().getName() + ">>>>>> SENDING MESSAGE 
TO '" + dest
+ "': " + wrapper.generateXMLMessage());
                publisher.send(msg);
}




        public MessageProducer getProducer(Destination dest, boolean persistent)
throws Exception {
                //just a little optimization so I don't have too many producing 
running
amock. Have 1 producer per destination

                         if (_producer_cache.containsKey(dest.toString()))
                        return _producer_cache.get(dest.toString());
                
                MessageProducer publisher = _session.createProducer(dest);
                if(persistent)
                        publisher.setDeliveryMode(DeliveryMode.PERSISTENT);
                else
                        publisher.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
                
                _producer_cache.put(dest.toString(), publisher);
                return publisher;
        }


/********************************************************************
         * Create a topic
         * @param name
         * @return
         * @throws JMSException
         * 
         *******************************************************************/
        public Destination createDestination(String name, DESTINATION_TYPE
destination) throws JMSException {
                switch (destination) {
                case TOPIC:
                        return _session.createTopic(name);
                case QUEUE:
                        return _session.createQueue(name);
                default:
                        return null;
                }
        }



rajdavies wrote:
> 
> be great if you could come up with a test case!
> On 8 Jul 2008, at 18:49, sparky2708 wrote:
> 
>>
>> I am using ActiveMQ 5.1.0 and I can't explain the following in  
>> JConsole (I
>> never pressed resetStats()). This seems to happen to most of my  
>> topics:
>>
>> http://www.nabble.com/file/p18345113/untitled.jpg
>>
>> Any ideas?
>> -- 
>> View this message in context:
>> http://www.nabble.com/How-can-Dequeuecount-%3D%3D-Enqueuecount-%3D%3D-Dispatchcount-and-QueueSize-%21%3D-0--tp18345113p18345113.html
>> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>>
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/How-can-Dequeuecount-%3D%3D-Enqueuecount-%3D%3D-Dispatchcount-and-QueueSize-%21%3D-0--tp18345113p18347115.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Reply via email to