Results 1 to 2 of 2

Thread: Using JmsTemplate outside a container

  1. #1
    Join Date
    Apr 2005
    Posts
    12

    Default Using JmsTemplate outside a container

    Hi,

    We've been using the JmsTemplate for some time now to send messages, e.g.,

    jms_template.send(workflow_status_topic, new MessageCreator() {
    public Message createMessage(Session session) throws JMSException {
    return session.createObjectMessage(status);

    And we've run this code WITHIN a JEE container, taking advantage of the fact that the container vendor supports Session wrappers (i.e., pooling).

    Now we want to use this same jms_template technique to send messages OUTSIDE a container (from multiple user-managed threads) and so we no longer have the container feature that provides Session pooling for us and so my question is: is there a big performance penality because the JmsTemplate always creates a new Session, uses it to send the message, then destroys (ie. closes()) the Sessson on every message send?

    Btw- Our Sessions are setup to be non-transacted

    Would a better alternative be to have each user-thread directly manage Sessions itself (using all the JMS api gory details), instead of using the JmsTemplate approach in this case (i.e., running outside a container)?

    Or maybe its possible for us to write our own Session pooling mechanism? But what exactly does that imply, i.e., we need to intercept the close() call on the Session and then do what to the Session?

    any ideas would be greatly appreciated!

    -mike
    mike mcknerney

  2. #2
    Join Date
    May 2007
    Location
    Saint Petersburg, Russian Federation
    Posts
    1,189

    Default

    You may have a look at jencks framework. It offers necessary pooling facilities.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •