ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » IBM MQ Java / JMS » Connection and Session in WAS

Post new topic  Reply to topic
 Connection and Session in WAS « View previous topic :: View next topic » 
Author Message
ydsk
PostPosted: Sun Apr 30, 2006 2:41 pm    Post subject: Connection and Session in WAS Reply with quote

Chevalier

Joined: 23 May 2005
Posts: 410

Can someone pls tell me the difference between a Connection and a Session that a JMS client ( like WAS) makes to the JMS provider ( like MQ) ?

WAS creates a socket connection for every Session created.So, what is a connection actually ?

Thanks.
ydsk.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Mon May 01, 2006 6:14 pm    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

Connection and session govern different aspects of the JMS experience:
  1. the connection determines whether the consumer is able to receive any messages. To receive messages the connection has to be "started". To suspend the reception of messages the connection can be "stopped".
    When the connection gets "closed" it is stopped and cannot change status any more. It closes as well any object dependant on it.
  2. The session governs the transactional aspect of the JMS connection. The session references the connection and is dependant on it. You can have multiple sessions for the same connection. All operations tied to the same session are tied to the transactions that session handles.
    The session methods "commit" and "rollback" handle the transactional aspect of the standard "send" and "receive" operations.


Enjoy
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
lohitashwa
PostPosted: Tue May 23, 2006 2:48 am    Post subject: Reply with quote

Newbie

Joined: 05 May 2005
Posts: 5

Hi,

As per JMS Specifications:

Connection:
A JMS Connection is a client’s active connection to its JMS provider. It will typically allocate provider resources outside the Java virtual machine.
Connection objects support concurrent use.
A Connection serves several purposes:
• It encapsulates an open connection with a JMS provider. It typically
represents an open TCP/IP socket between a client and a provider’s service
daemon.
• Its creation is where client authentication takes place.
• It can specify a unique client identifier.
• It creates Session objects.
• It provides ConnectionMetaData.
• It supports an optional ExceptionListener.
Due to the authentication and communication setup done when a Connection is
created, a Connection is a relatively heavyweight JMS object. Most clients will
do all their messaging with a single Connection. Other more advanced
applications may use several Connections. JMS does not architect a reason for
using multiple connections (other than when a client acts as a gateway
between two different providers); however, there may be operational reasons
for doing so.

Session:
A JMS Session is a single-threaded context* for producing and consuming
messages. Although it may allocate provider resources outside the Java virtual
machine, it is considered a lightweight JMS object.
A Session serves several purposes:
• It is a factory for its MessageProducers and MessageConsumers.
• It is a factory for TemporaryTopics and TemporaryQueues.
• It provides a way to create Queue or Topic objects for those clients that need
to dynamically manipulate provider-specific destination names.
• It supplies provider-optimized message factories.
• It supports a single series of transactions that combine work spanning this
session’s producers and consumers into atomic units.
• It defines a serial order for the messages it consumes and the messages it
produces.
• It retains messages it consumes until they have been acknowledged.
• It serializes execution of MessageListeners registered with it.
• It is a factory for QueueBrowsers.

Hope this gives an insight on the difference between the connection and the session, do let me know if you require additional assistance or information.

Regards
Lohitashwa T
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » IBM MQ Java / JMS » Connection and Session in WAS
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.