java - Should I use just one Session in my application based on HornetQ? -


in application based on hornetq engine intend create multiple producers , consumers. have learned, should reuse resources as possible this page.

does mean, application should crate 1 , 1 connectionfactory, 1 connection, 1 session , (using session object) creating many producers/consumers want?

that shouldn't hard, i'm not sure if proper approach.

the best rule of thumb minimum resource usage use fewest constructs possible while remaining thread safe. accordingly:

  1. connection factories thread safe: 1 per jms server (or 1 per jms server per destination type topics , queues)
  2. connections thread safe: depending on application architecture, may able use 1 connection, not bend on backwards this.
  3. sessions , constructs below session not thread safe: need 1 session per concurrent thread (or per transaction if think way).

based on that, can strike balance between elegant architecture , low resource utilization.


Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -