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:
- connection factories thread safe: 1 per jms server (or 1 per jms server per destination type topics , queues)
- connections thread safe: depending on application architecture, may able use 1 connection, not bend on backwards this.
- 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
Post a Comment