Habari STOMP Client for RabbitMQ 9.4
Object Pascal STOMP client library for RabbitMQ
Loading...
Searching...
No Matches
ISession Interface Reference

Represents a single unit of work on an IConnection. More...

Inheritance diagram for ISession:

Public Member Functions

 Close ()
 Closes the session.
 Commit ()
 If this is a transactional session then commit all message send and acknowledgements for producers and consumers in this session.
IBytesMessage CreateBytesMessage ()
 Creates an IBytesMessage object.
IMessageConsumer CreateConsumer (const IDestination Destination)
 Creates an IMessageConsumer for the specified destination.
IMessageConsumer CreateConsumer (const IDestination Destination, const string MessageSelector)
 Creates an IMessageConsumer for the specified destination, using a message selector.
IMessageConsumer CreateConsumer (const IDestination Destination, const string MessageSelector, const Boolean NoLocal)
 Creates an IMessageConsumer for the specified destination, using a message selector.
ITopicSubscriber CreateDurableSubscriber (const ITopic Topic, const string Name)
 Creates a durable subscriber to the specified topic.
ITopicSubscriber CreateDurableSubscriber (const ITopic Topic, const string Name, const string MessageSelector, const Boolean NoLocal)
 Creates a durable subscriber to the specified topic, using a message selector and specifying whether messages published by its own connection should be delivered to it.
IMessage CreateMessage ()
 Creates an IMessage object.
IMessageProducer CreateProducer (const IDestination Destination)
 Creates a producer of messages on a given destination.
IQueue CreateQueue (const string QueueName)
 Creates a queue identity given an IQueue name.
ITemporaryQueue CreateTemporaryQueue ()
 Creates an ITemporaryQueue object.
ITemporaryTopic CreateTemporaryTopic ()
 Creates an ITemporaryTopic object.
IObjectMessage CreateObjectMessage ()
 Creates an IObjectMessage object.
IObjectMessage CreateObjectMessage (const TObject AObject)
 Creates an initialized IObjectMessage object.
ITextMessage CreateTextMessage ()
 Creates an ITextMessage object.
IMapMessage CreateMapMessage ()
 Creates an IMapMessage object.
ITextMessage CreateTextMessage (const string Text)
 Creates an initialized ITextMessage object.
ITopic CreateTopic (const string TopicName)
 Creates a topic identity given an ITopic name.
 Rollback ()
 If this is a transactional session then rollback all message send and acknowledgements for producers and consumers in this session.
 Unsubscribe (const string Destination, const string Name)
 Unsubscribes a durable subscription that has been created by a client.
Broker-specific notes

These methods are only supported by ActiveMQ and Artemis.

IQueueBrowser CreateBrowser (const string QueueName)
 Creates an IQueueBrowser object to peek at the messages on the specified queue.

Public Attributes

TAcknowledgementMode AcknowledgeMode
 Returns the acknowledgement mode of the session.
Boolean Transacted
 Indicates whether the session is in transacted mode.

Detailed Description

Represents a single unit of work on an IConnection.

A Session object is a single-threaded context for producing and consuming messages.

A session serves several purposes:

  • It is a factory for its message producers and consumers.
  • It supplies message factories.
  • It provides a way to create IQueue or ITopic objects.
  • It supports a single series of transactions.

A session can create and service multiple message producers and consumers.

One typical use is to have a thread block on a synchronous IMessageConsumer until a message arrives. The thread may then use one or more of the ISession's IMessageProducers.

If a client desires to have one thread produce messages while others consume them, the client should use a separate connection for its producing thread.

It should be easy for most clients to partition their work naturally into sessions. This model allows clients to start simply and incrementally add message processing complexity as their need for concurrency grows.

A session may be specified as transacted. Each transacted session supports a single series of transactions.

A transaction is completed using either its session's commit method or its session's rollback method. The completion of a session's current transaction automatically begins the next. The result is that a transacted session always has a current transaction within which its work is done.

Member Function Documentation

◆ Close()

ISession::Close ( )

Closes the session.

◆ Commit()

ISession::Commit ( )

If this is a transactional session then commit all message send and acknowledgements for producers and consumers in this session.

Exceptions
EMQExceptionif the session is not transacted

◆ CreateBrowser()

IQueueBrowser ISession::CreateBrowser ( const string QueueName)

Creates an IQueueBrowser object to peek at the messages on the specified queue.

This feature requires STOMP 1.1

Returns
an IQueueBrowser
Note
Not supported by OpenMQ and RabbitMQ.

◆ CreateBytesMessage()

IBytesMessage ISession::CreateBytesMessage ( )

Creates an IBytesMessage object.

An IBytesMessage object is used to send a message containing a stream of uninterpreted bytes.

Returns
the IBytesMessage

◆ CreateConsumer() [1/3]

IMessageConsumer ISession::CreateConsumer ( const IDestination Destination)

Creates an IMessageConsumer for the specified destination.

Since IQueue and ITopic both inherit from IDestination, they can be used in the destination parameter to create an IMessageConsumer.

Parameters
Destinationthe IDestination to access.
Returns
the IMessageConsumer

◆ CreateConsumer() [2/3]

IMessageConsumer ISession::CreateConsumer ( const IDestination Destination,
const string MessageSelector )

Creates an IMessageConsumer for the specified destination, using a message selector.

Since IQueue and ITopic both inherit from IDestination, they can be used in the destination parameter to create a IMessageConsumer.

A client uses an IMessageConsumer object to receive messages that have been sent to a destination.

Parameters
Destinationthe IDestination to access
MessageSelectoronly messages with properties matching the message selector expression are delivered. An empty string indicates that there is no message selector for the message consumer.
Returns
the MessageConsumer
Note
MessageSelector is not supported by RabbitMQ

◆ CreateConsumer() [3/3]

IMessageConsumer ISession::CreateConsumer ( const IDestination Destination,
const string MessageSelector,
const Boolean NoLocal )

Creates an IMessageConsumer for the specified destination, using a message selector.

This method can specify whether messages published by its own connection should be delivered to it, if the destination is a topic.

Since IQueue and ITopic both inherit from IDestination, they can be used in the destination parameter to create an IMessageConsumer.

A client uses an IMessageConsumer object to receive messages that have been published to a destination.

In some cases, a connection may both publish and subscribe to a topic. The consumer noLocal attribute allows a consumer to inhibit the delivery of messages published by its own connection. The default value for this attribute is False.

Parameters
Destinationthe IDestination to access
MessageSelectoronly messages with properties matching the message selector expression are delivered. An empty string indicates that there is no message selector for the message consumer.
NoLocal- if true, and the destination is a topic, inhibits the delivery of messages published by its own connection. The behavior for NoLocal is not specified if the destination is a queue.
Returns
the MessageConsumer
Note
MessageSelector is not supported by RabbitMQ
NoLocal is not supported by RabbitMQ

◆ CreateDurableSubscriber() [1/2]

ITopicSubscriber ISession::CreateDurableSubscriber ( const ITopic Topic,
const string Name )

Creates a durable subscriber to the specified topic.

Parameters
Topic- the non-temporary ITopic to subscribe to
Name- the name used to identify this subscription
Returns
the ITopicSubscriber
Exceptions
EMQExceptionif the session fails to create a subscriber due to some internal error.

◆ CreateDurableSubscriber() [2/2]

ITopicSubscriber ISession::CreateDurableSubscriber ( const ITopic Topic,
const string Name,
const string MessageSelector,
const Boolean NoLocal )

Creates a durable subscriber to the specified topic, using a message selector and specifying whether messages published by its own connection should be delivered to it.

Parameters
Topic- the non-temporary ITopic to subscribe to
Name- the name used to identify this subscription
MessageSelectoronly messages with properties matching the message selector expression are delivered. An empty string indicates that there is no message selector for the message consumer.
NoLocal- if true, and the destination is a topic, inhibits the delivery of messages published by its own connection. The behavior for NoLocal is not specified if the destination is a queue.
Returns
the ITopicSubscriber
Note
MessageSelector is not supported by RabbitMQ
NoLocal is not supported by RabbitMQ

◆ CreateMapMessage()

IMapMessage ISession::CreateMapMessage ( )

Creates an IMapMessage object.

An IMapMessage object is used to send a self-defining set of name-value pairs, where names are String objects and values are primitive values in the Java programming language.

Returns
an IMapMessage

◆ CreateMessage()

IMessage ISession::CreateMessage ( )

Creates an IMessage object.

The IMessage interface is the root interface of all messages. An IMessage object holds all the standard message header information. It can be sent when a message containing only header information is sufficient.

Returns
an IMessage

◆ CreateObjectMessage() [1/2]

IObjectMessage ISession::CreateObjectMessage ( )

Creates an IObjectMessage object.

An IObjectMessage object is used to send a message that contains a serializable object.

Returns
an IObjectMessage

◆ CreateObjectMessage() [2/2]

IObjectMessage ISession::CreateObjectMessage ( const TObject AObject)

Creates an initialized IObjectMessage object.

An IObjectMessage object is used to send a message that contains a serializable object.

Parameters
AObjectthe object to use to initialize this message
Returns
an IObjectMessage

◆ CreateProducer()

IMessageProducer ISession::CreateProducer ( const IDestination Destination)

Creates a producer of messages on a given destination.

◆ CreateQueue()

IQueue ISession::CreateQueue ( const string QueueName)

Creates a queue identity given an IQueue name.

Parameters
QueueNamethe name of this IQueue
Returns
an IQueue with the given name

◆ CreateTemporaryQueue()

ITemporaryQueue ISession::CreateTemporaryQueue ( )

Creates an ITemporaryQueue object.

Its lifetime will be that of the Connection unless it is deleted earlier.

◆ CreateTemporaryTopic()

ITemporaryTopic ISession::CreateTemporaryTopic ( )

Creates an ITemporaryTopic object.

Its lifetime will be that of the Connection unless it is deleted earlier.

Returns
an ITemporaryTopic

◆ CreateTextMessage() [1/2]

ITextMessage ISession::CreateTextMessage ( )

Creates an ITextMessage object.

An ITextMessage object is used to send a message containing a String object.

Returns
an ITextMessage

◆ CreateTextMessage() [2/2]

ITextMessage ISession::CreateTextMessage ( const string Text)

Creates an initialized ITextMessage object.

An ITextMessage object is used to send a message containing a String.

Parameters
Textthe string used to initialize this message
Returns
an ITextMessage

◆ CreateTopic()

ITopic ISession::CreateTopic ( const string TopicName)

Creates a topic identity given an ITopic name.

Parameters
TopicNamethe name of this ITopic
Returns
an ITopic with the given name

◆ Rollback()

ISession::Rollback ( )

If this is a transactional session then rollback all message send and acknowledgements for producers and consumers in this session.

Exceptions
EMQExceptionif the session is not transacted

◆ Unsubscribe()

ISession::Unsubscribe ( const string Destination,
const string Name )

Unsubscribes a durable subscription that has been created by a client.

Parameters
Destination- the destination name
Name- the name used to identify this subscription
Exceptions
EMQExceptionif the session fails to unsubscribe to the durable subscription due to some internal error.

Member Data Documentation

◆ AcknowledgeMode

TAcknowledgementMode ISession::AcknowledgeMode

Returns the acknowledgement mode of the session.

The acknowledgement mode is set at the time that the session is created.

See also
GetAcknowledgeMode For reading

◆ Transacted

Boolean ISession::Transacted

Indicates whether the session is in transacted mode.

See also
GetTransacted For reading