On Fri, Nov 27, 2009 at 7:39 PM, Uday Subbarayan <uday.subbara...@yahoo.com> wrote: > Thanks Bruce. My config is like yours and /etc/hosts also fine. I am now > writing my own consumer and having some problem....i get "null" message. > > My producer is http post, admin page correctly shows the message but having > problem with consumer. I am looking in to it right now.
Two things: 1) What are the steps you're using the to run the examples? Below are the steps I use: a) In terminal one, start up ActiveMQ (where $ACTIVEMQ_HOME is equal to the directory in which ActiveMQ is installed): $ cd $ACTIVEMQ_HOME $ ./bin/activemq b) In terminal two, run the producer using the following commands: $ cd $ACTIVEMQ_HOME/example $ ant producer -Dsubject=myqueue c) In terminal two, after the producer finishes, run the consumer using the following command: $ ant consumer -Dsubject=myqueue These steps yield the proper behavior of both ActiveMQ and the producer/consumer example. 2) Anytime I encounter folks who need to write their own JMS clients, I always encourage them to first look at the Spring JMS APIs. For JMS message consumers, I suggest starting with the Spring DefaultMessageListenerContainer: http://static.springsource.org/spring/docs/2.5.x/api/org/springframework/jms/listener/DefaultMessageListenerContainer.html The DefaultMessageListenerContainer (DMLC) provides the ability to set a range of concurrent consumers, various tiered caching levels (connection, session, consumer), it works with transactions and much more. The reason I recommend the DMLC (or one of the other message listener containers) is because writing JMS clients is a lot of work and the Spring message listener containers dramatically reduce the complexity thereby saving you quite a lot of time. Given the tremendous flexibility, the robustness, the high amount of configurability and the widespread deployment in businesses all over the world (including in the financial markets), there really is no reason not to use it. Additionally, the combination of the Spring CachingConnectionFactory and the DMLC is a good all around solution that I highly recommend for consuming messages. The CachingConnectionFactory is also good for sending messages because it can cache producers and sessions. http://static.springsource.org/spring/docs/2.5.x/api/org/springframework/jms/connection/CachingConnectionFactory.html The last bit needed then is a JMS message producer. For this I recommend the Spring JmsTemplate: http://static.springsource.org/spring/docs/2.5.x/api/org/springframework/jms/core/JmsTemplate.html Just make sure to use the CachingConnectionFactory with the JmsTemplate so that JMS connections are not repeatedly created and destroyed for every send. Together, these tools will speed your JMS development markedly. Bruce -- perl -e 'print unpack("u30","D0G)u8...@4vyy9&5R\"F)R=6-E+G-N>61E<D\!G;6%I;\"YC;VT*" );' ActiveMQ in Action: http://bit.ly/2je6cQ Blog: http://bruceblog.org/ Twitter: http://twitter.com/brucesnyder