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
Connectionobject’screateSession()method to create aSessionobject.For example, to create a
Sessionthat uses the defaultAUTO_ACKNOWLEDGEsession mode:Session session = connection.createSession();The EMS extended session modes, such as
NO_ACKNOWLEDGE, require that you include thecom.tibco.tibjms.Tibjmsconstant when you specify the EMS session mode. For example, to create aSessionthat uses theNO_ACKNOWLEDGEsession mode:Session session =
connection.createSession(com.tibco.tibjms.Tibjms.NO_ACKNOWLEDGE);See the
tibjmsMsgProducer.javasample client for a working example. - C
Use the
tibemsConnection_CreateSessionfunction to create a session of typetibemsSession:tibemsSession session = NULL;status = tibemsConnection_CreateSession(connection,&session, TIBEMS_FALSE, TIBEMS_AUTO_ACKNOWLEDGE);See the
tibemsMsgProducer.csample client for a working example. - C#
Use the
Connection.CreateSessionmethod to create aSessionobject:Session session = connection.CreateSession(false, Session.AUTO_ACKNOWLEDGE);See the
csMsgProducer.cssample client for a working example.