Announcement Announcement Module
No announcement yet.
Should I have 1 or more instances of my producer? Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Should I have 1 or more instances of my producer?

    Hi, I am new to JMS and Spring, but have been able to write to a queue with JmsTemplate through a POJO that implements the method "sendTextMessage" which puts a TextMessage on the queue. I am using ActiveMQ and the org.apache.activemq.pool.PooledConnectionFactory, because from what I read that seemed the easiest way of ensuring that I don't loose performance from creating and shutting down a lot of connections.

    I want to understand how the pooling actually works, but haven't been able to find any information on the web explaining it more in detail.

    My main problem though is to understand if I should create an instance of my POJO every time I want to put a message on the queue. The solution we are gonna make will be that when a webserver gets an request it will call a service, that service will use the POJO to write to the queue. Should I create an instance of my POJO (containing the JmsTemplate) everytime the service is called?

    The reason I am asking this is because we want to be able to handle a lot of incoming messages and I am not sure if creating this POJO will have any great cost on performance, and if so how to solve it. should I have a pool for the POJO as well or only one instance etc.

    I hope someone with more programming experience and experience with JMS can point me in the right direction