On 14 May 2008, at 20:18, code.junkie wrote:


Hi All,

I am planning to use ActiveMQ with a java project that I am working on. I am planning to use a queue with persisted for reliable messaging ( guaranteed messaging ). In that regard I have couple of questions for which I would
love to get some views on:

Great! persistence is the default delivery mode for Queues - so no problems there.
1) It is my understanding that I can either use ActiveMQ's APIs directly or use via JMS ( using jndi). I am not sure what is the advantage of using the
JMS approach over using the activemq's apis directly?
Keeping to the JMS interface directly will give you more independence - though things may be a little easier to get started if you use an ActiveMQConnectionFactory directly.
However,  instead of JNDI you could use Spring - see 
http://activemq.apache.org/spring-support.html


2) I am planning to use batching for sending messages (persistent) to the
queue and was confused by reading
http://activemq.apache.org/how-do-i-enable-asynchronous-sending.html
Should I still be using jms.useAsyncSend=true in case of batching ?
The easiest way to batch messages is to use a transaction - see http://activemq.apache.org/how-do-transactions-work.html - that will send async anyway though the commit will be synchronous


3) What is a good practice for consumer? Should I be reading the messages from the queue within a transaction? ( The reason being that I am using Session.SESSION_TRANSACTED for the producer, so what should be the proper way in consumer assuming producer and consumer processes at the same speed)
Why not use transactions for the consumer ? - there maybe a marginal improvement in performance - as it allows us to batch up the acknowledgements back to the server. Note of caution though - ensure the transaction boundary is smaller than the prefetch size - see http://activemq.apache.org/what-is-the-prefetch-limit-for.html
it makes the broker have to work less!


Thanks in advance!
- Rakesh


3)
--
View this message in context: 
http://www.nabble.com/Newbie-questions-tp17238878s2354p17238878.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.






cheers,

Rob

http://open.iona.com/products/enterprise-activemq
http://rajdavies.blogspot.com/




Reply via email to