• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

JMS Sender class as an EJB ?

 
Ranch Hand
Posts: 188
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have created a class to send messages to a JBoss queue. It works well but there is a lot of overhead with each send method call (roughly 60% from what I can tell) since each time I'm doing JNDI lookups of the QueueConnectionFactory and Queue, and then establishing the QueueConnection, QueueSession, and QueueSender. I'm thinking that if I convert the class to a stateless session EJB then I could persist the QueueConnection, QueueSession, and QueueSender as instance variables and avoid this overhead with each call. My idea is to perform the lookups and initializations in my ejbCreate() method, use the QueueSender and QueueSession instance variables to do the send and commit in my send method, and then close the connection and session in my ejbRemove() method. Is this the right way to go about this ? If so then are there any further considerations for a clustered application ?

Thanks in advance for any suggestions.


--James
 
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have done something similar, but I limited what I did in the ejbCreate to only the lookups and getting the QueueConnection. In other words, lookup the QueueConnectionFactory, lookup the Queue, call createQueueConnection on the QueueConnectionFactory. That eliminates the majority of the speed issues.

The main reason I didn't keep the session around was because I was concerned that keeping a session open for a long period of time could cause problems. I really don't know if that is true or not.
 
What are you doing in my house? Get 'em tiny ad!
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic