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
For example, to create a Session that uses the default AUTO_ACKNOWLEDGE session mode:
Session session = connection.createSession();
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 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.