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

Encapsulates a set of connection configuration parameters that has been defined by an administrator. More...

Inheritance diagram for TBTAbstractConnectionFactory:
IConnectionFactory IClientLibraryInfoProvider TBTConnectionFactory

Public Member Functions

IConnection CreateConnection ()
 Creates a connection with the default user identity.
IConnection CreateConnection (const string UserName, const string Password)
 Creates a connection with the specified user identity.
IMQContext CreateContext ()
 Creates a messaging context with default settings.
IMQContext CreateContext (const TAcknowledgementMode AcknowledgeMode)
 Creates a messaging context with the specified acknowledgment mode.
IMQContext CreateContext (const string Username, const string Password)
 Creates a messaging context with the specified user credentials.
IMQContext CreateContext (const string Username, const string Password, const TAcknowledgementMode AcknowledgeMode)
 Creates a messaging context with the specified user credentials and acknowledgment mode.
 TBTAbstractConnectionFactory ()
 TBTAbstractConnectionFactory (const string BrokerURL)
 TBTAbstractConnectionFactory (const string UserName, const string Password, const string BrokerURL)
TBTConnection CreateMQConnection ()
 Creates a connection with the default user identity.
TBTConnection CreateMQConnection (const string UserName, const string Password)
 Creates a connection with the specified user identity.

Public Attributes

string ClientID
 Specifies the client ID to be used for the created connection.
Integer ConnectTimeOut
 Specifies the connection timeout in milliseconds.
string UserName
 Specifies the username to be used by connections created by this factory.
string Password
 Specifies the password to be used by connections created by this factory.
string BrokerURL
 Specifies the connection URL used to connect to the broker.
Integer SendTimeOut
 Specifies the send timeout in milliseconds.

Protected Member Functions

TBTAbstractTransport CreateTransport ()
IClientLibraryInfo ClientLibraryInfo ()
 Retrieves an IClientLibraryInfo instance.

Detailed Description

Encapsulates a set of connection configuration parameters that has been defined by an administrator.

A client uses it to create a connection with a provider.

A connection factory instance is usually created and configured only once.

It then may be used to create actual connection objects when needed. For example, a worker thread may create the connection factory at program start-up and use it to create a new connection object whenever a connection failure occurred.

The TBTAbstractConnectionFactory introduces configuration properties which are only needed at the time of instantiation. They are intentionally not part of the IConnectionFactory methods.


function TExample.CreateConfiguredFactory: IConnectionFactory;
var
begin
// ------------------------------------------------------------
// create and assign to local variable
// ------------------------------------------------------------
Factory := TBTConnectionFactory.Create;
// ------------------------------------------------------------
// additional configuration
// ------------------------------------------------------------
Factory.BrokerURL := 'broker.example.com';
Factory.UserName := 'guest';
Factory.Password := 'guest';
Factory.ClientID := 'myclientId';
Factory.SendTimeOut := 10000;
Factory.ConnectTimeOut := 10000;
// ------------------------------------------------------------
// return the configured factory
// ------------------------------------------------------------
Result := Factory;
end;
Encapsulates a set of connection configuration parameters that has been defined by an administrator.
Definition BTMQInterfaces.pas:2130
string BrokerURL
Specifies the connection URL used to connect to the broker.
Definition BTAbstractConnectionFactory.pas:221
Encapsulates a set of connection configuration parameters that has been defined by an administrator.
Definition BTConnectionFactory.pas:29

Constructor & Destructor Documentation

◆ TBTAbstractConnectionFactory() [1/3]

TBTAbstractConnectionFactory::TBTAbstractConnectionFactory ( )

◆ TBTAbstractConnectionFactory() [2/3]

TBTAbstractConnectionFactory::TBTAbstractConnectionFactory ( const string BrokerURL)

◆ TBTAbstractConnectionFactory() [3/3]

TBTAbstractConnectionFactory::TBTAbstractConnectionFactory ( const string UserName,
const string Password,
const string BrokerURL )

Member Function Documentation

◆ ClientLibraryInfo()

IClientLibraryInfo TBTAbstractConnectionFactory::ClientLibraryInfo ( )
protected

Retrieves an IClientLibraryInfo instance.

Returns
An IClientLibraryInfo instance containing details such as the library name, version, and copyright information.

Implements IClientLibraryInfoProvider.

◆ CreateConnection() [1/2]

IConnection TBTAbstractConnectionFactory::CreateConnection ( )

Creates a connection with the default user identity.

The connection is created in a stopped mode, meaning no messages will be delivered until the Connection.Start method is explicitly called.

Returns
An IConnection object representing the created connection.

Implements IConnectionFactory.

◆ CreateConnection() [2/2]

IConnection TBTAbstractConnectionFactory::CreateConnection ( const string Username,
const string Password )

Creates a connection with the specified user identity.

The connection is created in a stopped mode, meaning no messages will be delivered until the Connection.Start method is explicitly called.

Parameters
UsernameThe username for the connection.
PasswordThe password for the connection.
Returns
An IConnection object representing the created connection.

Implements IConnectionFactory.

◆ CreateContext() [1/4]

IMQContext TBTAbstractConnectionFactory::CreateContext ( )

Creates a messaging context with default settings.

Returns
An IMQContext instance representing the created context.

Implements IConnectionFactory.

◆ CreateContext() [2/4]

IMQContext TBTAbstractConnectionFactory::CreateContext ( const string Username,
const string Password )

Creates a messaging context with the specified user credentials.

Parameters
UsernameThe username for the context.
PasswordThe password for the context.
Returns
An IMQContext instance representing the created context.

Implements IConnectionFactory.

◆ CreateContext() [3/4]

IMQContext TBTAbstractConnectionFactory::CreateContext ( const string Username,
const string Password,
const TAcknowledgementMode AcknowledgeMode )

Creates a messaging context with the specified user credentials and acknowledgment mode.

Parameters
UsernameThe username for the context.
PasswordThe password for the context.
AcknowledgeModeThe acknowledgment mode for the context.
Returns
An IMQContext instance representing the created context.

Implements IConnectionFactory.

◆ CreateContext() [4/4]

IMQContext TBTAbstractConnectionFactory::CreateContext ( const TAcknowledgementMode AcknowledgeMode)

Creates a messaging context with the specified acknowledgment mode.

Parameters
AcknowledgeModeThe acknowledgment mode for the context.
Returns
An IMQContext instance representing the created context.

Implements IConnectionFactory.

◆ CreateMQConnection() [1/2]

TBTConnection TBTAbstractConnectionFactory::CreateMQConnection ( )

Creates a connection with the default user identity.

The connection is created in a stopped mode, meaning no messages will be delivered until the Connection.Start method is explicitly called.

Returns
A TBTConnection instance representing the created connection.

◆ CreateMQConnection() [2/2]

TBTConnection TBTAbstractConnectionFactory::CreateMQConnection ( const string UserName,
const string Password )

Creates a connection with the specified user identity.

The connection is created in a stopped mode, meaning no messages will be delivered until the Connection.Start method is explicitly called.

Parameters
UserNameThe username for the connection.
PasswordThe password for the connection.
Returns
A TBTConnection instance representing the created connection.

◆ CreateTransport()

TBTAbstractTransport TBTAbstractConnectionFactory::CreateTransport ( )
protected

Member Data Documentation

◆ BrokerURL

string TBTAbstractConnectionFactory::BrokerURL

Specifies the connection URL used to connect to the broker.

This URL defines the protocol, host, port, and optionally the username and password for the connection.

See also
GetBrokerURL For reading
SetBrokerURL For writing

◆ ClientID

string TBTAbstractConnectionFactory::ClientID

Specifies the client ID to be used for the created connection.

Note
This property can only be used by one connection at a time. It is generally recommended to set the client ID directly on a TBTConnection instance instead.
Todo
update / clarify documentation
See also
FClientID For reading
FClientID For writing

◆ ConnectTimeOut

Integer TBTAbstractConnectionFactory::ConnectTimeOut

Specifies the connection timeout in milliseconds.

Note
This is an experimental feature and is only implemented in Internet Direct (Indy).
Todo
update / clarify documentation
See also
FConnectTimeOut For reading
SetConnectTimeOut For writing

◆ Password

string TBTAbstractConnectionFactory::Password

Specifies the password to be used by connections created by this factory.

See also
FPassword For writing

◆ SendTimeOut

Integer TBTAbstractConnectionFactory::SendTimeOut

Specifies the send timeout in milliseconds.

Note
This is an experimental feature.
Todo
update / clarify documentation
See also
FSendTimeOut For reading
FSendTimeOut For writing

◆ UserName

string TBTAbstractConnectionFactory::UserName

Specifies the username to be used by connections created by this factory.

See also
FUserName For writing