A session is a single threaded context for sending and receiving messages.
xms::PropertyContext | +----xms::Session
For a list of the XMS defined properties of a Session object, see Properties of Session.
Method | Description |
---|---|
close | Close the session. |
commit | Commit all messages processed in the current transaction. |
createBrowser | Create a queue browser for the specified queue. |
createBrowser | Create a queue browser for the specified queue using a message selector. |
createBytesMessage | Create a bytes message. |
createConsumer | Create a message consumer for the specified destination. |
createConsumer | Create a message consumer for the specified destination using a message selector. |
createConsumer | Create a message consumer for the specified destination using a message selector and, if the destination is a topic, specifying whether the message consumer receives the messages published by its own connection. |
createDurableSubscriber | Create a durable subscriber for the specified topic. |
createDurableSubscriber | Create a durable subscriber for the specified topic using a message selector and specifying whether the durable subscriber receives the messages published by its own connection. |
createMapMessage | Create a map message. |
createMessage | Create a message that has no body. |
createObjectMessage | Create an object message. |
createProducer | Create a message producer to send messages to the specified destination. |
createQueue | Create a Destination object to represent a queue in the messaging server. |
createStreamMessage | Create a stream message. |
createTemporaryQueue | Create a temporary queue. |
createTemporaryTopic | Create a temporary topic. |
createTextMessage | Create a text message with an empty body. |
createTextMessage | Create a text message whose body is initialized with the specified text. |
createTopic | Create a Destination object to represent a topic. |
getAcknowledgeMode | Get the acknowledgement mode for the session. |
getHandle | Get the handle that a C application would use to access the session. |
getTransacted | Determine whether the session is transacted. |
isNull | Determine whether the Session object is a null object. |
recover | Recover the session. |
rollback | Rollback all messages processed in the current transaction. |
unsubscribe | Delete a durable subscription. |
xmsVOID close();
Close the session. If the session is transacted, any transaction in progress is rolled back.
All objects dependent on the session are deleted. For information about which objects are deleted, see Object Deletion.
If an application tries to close a session that is already closed, the call is ignored.
QueueBrowser createBrowser(const Destination & queue const String & messageSelector) const;
Create a queue browser for the specified queue using a message selector.
A null String object means that there is no message selector for the queue browser.
MessageConsumer createConsumer(const Destination & destination) const;
Create a message consumer for the specified destination.
MessageConsumer createConsumer(const Destination & destination, const String & messageSelector) const;
Create a message consumer for the specified destination using a message selector.
A null String object means that there is no message selector for the message consumer.
MessageConsumer createConsumer(const Destination & destination, const String & messageSelector, const xmsBOOL noLocal) const;
Create a message consumer for the specified destination using a message selector and, if the destination is a topic, specifying whether the message consumer receives the messages published by its own connection.
A null String object means that there is no message selector for the message consumer.
MessageConsumer createDurableSubscriber(const Destination & topic, const String & subscriptionName) const;
Create a durable subscriber for the specified topic.
This method is not valid for a real-time connection to a broker.
For more information about durable subscribers, see Durable subscribers.
MessageConsumer createDurableSubscriber(const Destination & topic, const String & subscriptionName; const String & messageSelector, const xmsBOOL noLocal) const;
Create a durable subscriber for the specified topic using a message selector and specifying whether the durable subscriber receives the messages published by its own connection.
This method is not valid for a real-time connection to a broker.
For more information about durable subscribers, see Durable subscribers.
A null String object means that there is no message selector for the durable subscriber.
MessageProducer createProducer(const Destination & destination) const;
Create a message producer to send messages to the specified destination.
If you specify a null Destination object, the message producer is created without a destination. In this case, the application must specify a destination every time it uses the message producer to send a message.
Destination createQueue(const String & queueName) const;
Create a Destination object to represent a queue in the messaging server.
This method does not create the queue in the messaging server. You must create the queue before an application can call this method.
Destination createTemporaryQueue() const;
The scope of the temporary queue is the connection. Only the sessions created by the connection can use the temporary queue.
The temporary queue remains until it is explicitly deleted, or the connection ends, whichever is the sooner.
For more information about temporary queues, see Temporary destinations.
Destination createTemporaryTopic() const;
The scope of the temporary topic is the connection. Only the sessions created by the connection can use the temporary topic.
The temporary topic remains until it is explicitly deleted, or the connection ends, whichever is the sooner.
For more information about temporary topics, see Temporary destinations.
TextMessage createTextMessage(const String & text) const;
Create a text message whose body is initialized with the specified text.
Destination createTopic(const String & topicName) const;
Create a Destination object to represent a topic.
xmsINT getAcknowledgeMode() const;
Get the acknowledgement mode for the session. The acknowledgement mode is specified when the session is created.
A session that is transacted has no acknowledgement mode.
For more information about acknowledgement modes, see Message acknowledgement.
xmsBOOL getTransacted() const;
Determine whether the session is transacted.
For a real-time connection to a broker, the method always returns xmsFALSE.
xmsVOID recover() const;
Recover the session. Message delivery is stopped and then restarted with the oldest unacknowledged message.
The session must not be a transacted session.
For more information about recovering a session, see Message acknowledgement.
xmsVOID unsubscribe(const String & subscriptionName) const;
Delete a durable subscription. The messaging server deletes the record of the durable subscription that it is maintaining and does not send any more messages to the durable subscriber.
This method is not valid for a real-time connection to a broker.