activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rob Davies <>
Subject Re: What is best practice for creating Producers?
Date Fri, 18 Apr 2008 06:41:00 GMT

On 18 Apr 2008, at 06:26, Aidan wrote:

> Hi,
> I am using ActiveMQ 5 and am having an issue with my server (running
> embedded broker) hitting a deadlock with in  
> MemoryUsage.waitForMemory. I
> have read the JIRA defects for this, however I have a question about  
> how I
> am using Producers in ActiveMQ (the file-system Cursor seems like it  
> would
> work nicely, but appears to only be configurable from the XML files,  
> whereas
> I use ActiveMQ and programatically configure it).
> Each time I want to send a message to the server from my client I  
> create a
> new Producer, send the message and close the producer. One of my co- 
> workers
> said that he thinks that this sounds like an anti-pattern. After using
> JProfiler and seeing how many ProducerId objects are created (and  
> don't
> appear to be garbage collected).
> So my question is: Should I be creating one producer per queue/topic  
> and
> re-using it, or am I able to create one-per-request?
> Cheers,
> Aidan
> -- 
> View this message in context:
> Sent from the ActiveMQ - User mailing list archive at

Say thanks to your co-worker! It is an anti-pattern.

  Please re-use your producers  - you don't even need one per  
destination - create a Producer with a null Destination - e.g.

Message producer = session.createProducer(null)


Rob -Enterprise Open Integration

View raw message