Copyright © TIBCO Software Inc. All Rights Reserved
Copyright © TIBCO Software Inc. All Rights Reserved


Chapter 11 Developing an EMS Client Application : Creating a Session

Creating a Session
A Session is a single-threaded context for producing or consuming messages. You create Message Producers or Message Consumers using Session objects. A Session can be transactional to enable a group of messages to be sent and received in a single transaction. A non-transactional Session can define the acknowledge mode of message objects received by the session. See Message Acknowledgement for details.
Java
Use the Connection object’s createSession() method to create a Session object.
For example, to create a non-transactional Session that uses the AUTO_ACKNOWLEDGE delivery mode:
   Session session = connection.createSession(
            false, javax.jms.Session.AUTO_ACKNOWLEDGE);
The EMS extended acknowledgement modes, such as NO_ACKNOWLEDGE, require that you include the com.tibco.tibjms.Tibjms constant when you specify the EMS delivery mode. For example, to create a non-transactional Session that uses the NO_ACKNOWLEDGE delivery mode:
   Session session = Connection.createSession(
            false, com.tibco.tibjms.Tibjms.NO_ACKNOWLEDGE);
See the tibjmsMsgProducer.java sample client for a working example.
C
Use the tibemsConnection_CreateSession function to create a session of type tibemsSession:
tibemsSession session = NULL;
   status = tibemsConnection_CreateSession(connection,
            &session, TIBEMS_FALSE, TIBEMS_AUTO_ACKNOWLEDGE);
See the tibemsMsgProducer.c sample client for a working example.
C#
Use the Connection.CreateSession method to create a Session object:
   Session session = connection.CreateSession(false,             Session.AUTO_ACKNOWLEDGE);
See the csMsgProducer.cs sample client for a working example.

Copyright © TIBCO Software Inc. All Rights Reserved
Copyright © TIBCO Software Inc. All Rights Reserved