activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James Strachan" <james.strac...@gmail.com>
Subject Re: Unable to create MessageProducer
Date Mon, 12 Nov 2007 16:02:36 GMT
On 12/11/2007, TOPPER_HARLEY <TREVOR.HIGGINS@ericsson.com> wrote:
> >"It could just be the socket has been dropped.":
> Is socket dropping a common occurence or simply related to the quality of
> the network one is running on (my TCP level knowledge isn't great).

Its normally a glitch in the network - or that the broker died.

> Would
> vm: style for the brokerURL prevent this since it would be insice JVM?

Yes


> This is our setup:
> We have a number of predefined topics which we use when broadcasting updates
> and number temp queues for direct request/responses communication (one for
> each of our clients). We maintain one connection on the server side and as
> we send data from different threads, we cache a threadlocal session object
> (since ActiveMQSession is for single thread use). For each individual
> message send, we create and destroy a MessageProducer based on the
> destination as follows:
>
> try {
>       // Thread local retrieval
>       final Session session = this.getSession();
>       producer = session.createProducer(destination);
>       producer.send(message);
> } finally {
>      if (producer != null) {
>          try {
>              producer.close();
>          } catch (final JMSException e) {
>                  e.printStackTrace();
>          }
>       }
> }

This is an inefficient way of using JMS BTW...

http://activemq.apache.org/how-do-i-use-jms-efficiently.html

you should try pool producers if you can.


> >"You night wanna enable failover...":
> We have only been assigned one port for the broker (specified obviously as
> part of the brokerURL property) so I dont know if failover can assist us:

Failover causes the client to reconnect to the broker if the socket dies.


>  my
> understanding of failover is that you need more than one URI and AMQ
> switches to another one if one broker goes down:

Not true - it works fine with a single broker URI

-- 
James
-------
http://macstrac.blogspot.com/

Open Source SOA
http://open.iona.com

Mime
View raw message