Create 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’screateSession()
method to create aSession
object.For example, to create a
Session
that uses the defaultAUTO_ACKNOWLEDGE
session mode:Session session = connection.createSession();
The EMS extended session modes, such as
NO_ACKNOWLEDGE
, require that you include thecom.tibco.tibjms.Tibjms
constant when you specify the EMS session mode. For example, to create aSession
that uses theNO_ACKNOWLEDGE
session mode:Session session =
connection.createSession(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 typetibemsSession
: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 aSession
object:Session session = connection.CreateSession(false, Session.AUTO_ACKNOWLEDGE);
See the
csMsgProducer.cs
sample client for a working example.