activemq-cpp-3.4.0
|
#include <src/main/activemq/core/ActiveMQConnectionFactory.h>
Public Member Functions | |
ActiveMQConnectionFactory () | |
ActiveMQConnectionFactory (const std::string &uri, const std::string &username="", const std::string &password="") | |
Constructor. | |
ActiveMQConnectionFactory (const decaf::net::URI &uri, const std::string &username="", const std::string &password="") | |
Constructor. | |
virtual | ~ActiveMQConnectionFactory () throw () |
virtual cms::Connection * | createConnection () |
Creates a connection with the default user identity. | |
virtual cms::Connection * | createConnection (const std::string &username, const std::string &password) |
Creates a connection with the specified user identity. | |
virtual cms::Connection * | createConnection (const std::string &username, const std::string &password, const std::string &clientId) |
Creates a connection with the specified user identity. | |
void | setUsername (const std::string &username) |
Sets the username that should be used when creating a new connection. | |
const std::string & | getUsername () const |
Gets the username that this factory will use when creating a new connection instance. | |
void | setPassword (const std::string &password) |
Sets the password that should be used when creating a new connection. | |
const std::string & | getPassword () const |
Gets the password that this factory will use when creating a new connection instance. | |
std::string | getClientId () const |
Gets the Configured Client Id. | |
void | setClientId (const std::string &clientId) |
Sets the Client Id. | |
void | setBrokerURI (const std::string &uri) |
Sets the Broker URI that should be used when creating a new connection instance. | |
void | setBrokerURI (const decaf::net::URI &uri) |
Sets the Broker URI that should be used when creating a new connection instance. | |
const decaf::net::URI & | getBrokerURI () const |
Gets the Broker URI that this factory will use when creating a new connection instance. | |
void | setExceptionListener (cms::ExceptionListener *listener) |
Set an CMS ExceptionListener that will be set on eat connection once it has been created. | |
cms::ExceptionListener * | getExceptionListener () const |
Returns the currently set ExceptionListener that will be set on any new Connection instance that is created by this factory. | |
void | setPrefetchPolicy (PrefetchPolicy *policy) |
Sets the PrefetchPolicy instance that this factory should use when it creates new Connection instances. | |
PrefetchPolicy * | getPrefetchPolicy () const |
Gets the pointer to the current PrefetchPolicy that is in use by this ConnectionFactory. | |
void | setRedeliveryPolicy (RedeliveryPolicy *policy) |
Sets the RedeliveryPolicy instance that this factory should use when it creates new Connection instances. | |
RedeliveryPolicy * | getRedeliveryPolicy () const |
Gets the pointer to the current RedeliveryPolicy that is in use by this ConnectionFactory. | |
bool | isDispatchAsync () const |
void | setDispatchAsync (bool value) |
Should messages be dispatched synchronously or asynchronously from the producer thread for non-durable topics in the broker? For fast consumers set this to false. | |
bool | isAlwaysSyncSend () const |
Gets if the Connection should always send things Synchronously. | |
void | setAlwaysSyncSend (bool value) |
Sets if the Connection should always send things Synchronously. | |
bool | isUseAsyncSend () const |
Gets if the useAsyncSend option is set. | |
void | setUseAsyncSend (bool value) |
Sets the useAsyncSend option. | |
bool | isUseCompression () const |
Gets if the Connection is configured for Message body compression. | |
void | setUseCompression (bool value) |
Sets whether Message body compression is enabled. | |
void | setCompressionLevel (int value) |
Sets the Compression level used when Message body compression is enabled, a value of -1 causes the Compression Library to use the default setting which is a balance of speed and compression. | |
int | getCompressionLevel () const |
Gets the currently configured Compression level for Message bodies. | |
unsigned int | getSendTimeout () const |
Gets the assigned send timeout for this Connector. | |
void | setSendTimeout (unsigned int timeout) |
Sets the send timeout to use when sending Message objects, this will cause all messages to be sent using a Synchronous request is non-zero. | |
unsigned int | getCloseTimeout () const |
Gets the assigned close timeout for this Connector. | |
void | setCloseTimeout (unsigned int timeout) |
Sets the close timeout to use when sending the disconnect request. | |
unsigned int | getProducerWindowSize () const |
Gets the configured producer window size for Producers that are created from this connector. | |
void | setProducerWindowSize (unsigned int windowSize) |
Sets the size in Bytes of messages that a producer can send before it is blocked to await a ProducerAck from the broker that frees enough memory to allow another message to be sent. | |
bool | isMessagePrioritySupported () const |
void | setMessagePrioritySupported (bool value) |
Set whether or not this factory should create Connection objects with the Message priority support function enabled. | |
Static Public Member Functions | |
static cms::Connection * | createConnection (const std::string &uri, const std::string &username, const std::string &password, const std::string &clientId="") |
Creates a connection with the specified user identity. | |
Static Public Attributes | |
static const std::string | DEFAULT_URI |
Protected Member Functions | |
virtual ActiveMQConnection * | createActiveMQConnection (const Pointer< transport::Transport > &transport, const Pointer< decaf::util::Properties > &properties) |
Create a new ActiveMQConnection instnace using the provided Transport and Properties. |
activemq::core::ActiveMQConnectionFactory::ActiveMQConnectionFactory | ( | ) |
activemq::core::ActiveMQConnectionFactory::ActiveMQConnectionFactory | ( | const std::string & | uri, |
const std::string & | username = "" , |
||
const std::string & | password = "" |
||
) |
Constructor.
url | the URI of the Broker we are connecting to. |
username | to authenticate with, defaults to "" |
password | to authenticate with, defaults to "" |
activemq::core::ActiveMQConnectionFactory::ActiveMQConnectionFactory | ( | const decaf::net::URI & | uri, |
const std::string & | username = "" , |
||
const std::string & | password = "" |
||
) |
Constructor.
uri | the URI of the Broker we are connecting to. |
username | to authenticate with, defaults to "" |
password | to authenticate with, defaults to "" |
virtual activemq::core::ActiveMQConnectionFactory::~ActiveMQConnectionFactory | ( | ) | throw () [virtual] |
virtual ActiveMQConnection* activemq::core::ActiveMQConnectionFactory::createActiveMQConnection | ( | const Pointer< transport::Transport > & | transport, |
const Pointer< decaf::util::Properties > & | properties | ||
) | [protected, virtual] |
Create a new ActiveMQConnection instnace using the provided Transport and Properties.
Subclasses can override this to control the actual type of ActiveMQConnection that is created.
transport | The Transport that the Connection should use to communicate with the Broker. |
properties | The Properties that are assigned to the new Connection instance. |
Reimplemented in activemq::core::ActiveMQXAConnectionFactory.
virtual cms::Connection* activemq::core::ActiveMQConnectionFactory::createConnection | ( | ) | [virtual] |
Creates a connection with the default user identity.
The connection is created in stopped mode. No messages will be delivered until the Connection.start method is explicitly called.
CMSException |
Implements cms::ConnectionFactory.
virtual cms::Connection* activemq::core::ActiveMQConnectionFactory::createConnection | ( | const std::string & | username, |
const std::string & | password | ||
) | [virtual] |
Creates a connection with the specified user identity.
The connection is created in stopped mode. No messages will be delivered until the Connection.start method is explicitly called. The username and password values passed here do not change the defaults, subsequent calls to the parameterless createConnection will continue to use the default values that were set in the Constructor.
username | to authenticate with |
password | to authenticate with |
CMSException |
Implements cms::ConnectionFactory.
static cms::Connection* activemq::core::ActiveMQConnectionFactory::createConnection | ( | const std::string & | uri, |
const std::string & | username, | ||
const std::string & | password, | ||
const std::string & | clientId = "" |
||
) | [static] |
Creates a connection with the specified user identity.
The connection is created in stopped mode. No messages will be delivered until the Connection.start method is explicitly called.
uri | The URI of the Broker we are connecting to. |
username | The name of the user to authenticate with. |
password | The password for the user to authenticate with. |
clientId | The unique client id to assign to connection, defaults to "". |
CMSException. |
virtual cms::Connection* activemq::core::ActiveMQConnectionFactory::createConnection | ( | const std::string & | username, |
const std::string & | password, | ||
const std::string & | clientId | ||
) | [virtual] |
Creates a connection with the specified user identity.
The connection is created in stopped mode. No messages will be delivered until the Connection.start method is explicitly called. The username and password values passed here do not change the defaults, subsequent calls to the parameterless createConnection will continue to use the default values that were set in the Constructor.
username | to authenticate with |
password | to authenticate with |
clientId | to assign to connection if "" then a random cleint Id is created for this connection. |
CMSException |
Implements cms::ConnectionFactory.
const decaf::net::URI& activemq::core::ActiveMQConnectionFactory::getBrokerURI | ( | ) | const |
Gets the Broker URI that this factory will use when creating a new connection instance.
std::string activemq::core::ActiveMQConnectionFactory::getClientId | ( | ) | const |
Gets the Configured Client Id.
unsigned int activemq::core::ActiveMQConnectionFactory::getCloseTimeout | ( | ) | const |
Gets the assigned close timeout for this Connector.
int activemq::core::ActiveMQConnectionFactory::getCompressionLevel | ( | ) | const |
Gets the currently configured Compression level for Message bodies.
cms::ExceptionListener* activemq::core::ActiveMQConnectionFactory::getExceptionListener | ( | ) | const |
Returns the currently set ExceptionListener that will be set on any new Connection instance that is created by this factory.
const std::string& activemq::core::ActiveMQConnectionFactory::getPassword | ( | ) | const |
Gets the password that this factory will use when creating a new connection instance.
PrefetchPolicy* activemq::core::ActiveMQConnectionFactory::getPrefetchPolicy | ( | ) | const |
Gets the pointer to the current PrefetchPolicy that is in use by this ConnectionFactory.
unsigned int activemq::core::ActiveMQConnectionFactory::getProducerWindowSize | ( | ) | const |
Gets the configured producer window size for Producers that are created from this connector.
This only applies if there is no send timeout and the producer is able to send asynchronously.
RedeliveryPolicy* activemq::core::ActiveMQConnectionFactory::getRedeliveryPolicy | ( | ) | const |
Gets the pointer to the current RedeliveryPolicy that is in use by this ConnectionFactory.
unsigned int activemq::core::ActiveMQConnectionFactory::getSendTimeout | ( | ) | const |
Gets the assigned send timeout for this Connector.
const std::string& activemq::core::ActiveMQConnectionFactory::getUsername | ( | ) | const |
Gets the username that this factory will use when creating a new connection instance.
bool activemq::core::ActiveMQConnectionFactory::isAlwaysSyncSend | ( | ) | const |
Gets if the Connection should always send things Synchronously.
bool activemq::core::ActiveMQConnectionFactory::isDispatchAsync | ( | ) | const |
bool activemq::core::ActiveMQConnectionFactory::isMessagePrioritySupported | ( | ) | const |
bool activemq::core::ActiveMQConnectionFactory::isUseAsyncSend | ( | ) | const |
Gets if the useAsyncSend option is set.
bool activemq::core::ActiveMQConnectionFactory::isUseCompression | ( | ) | const |
Gets if the Connection is configured for Message body compression.
void activemq::core::ActiveMQConnectionFactory::setAlwaysSyncSend | ( | bool | value | ) |
Sets if the Connection should always send things Synchronously.
value | true if sends should always be Synchronous. |
void activemq::core::ActiveMQConnectionFactory::setBrokerURI | ( | const decaf::net::URI & | uri | ) |
Sets the Broker URI that should be used when creating a new connection instance.
brokerURI | The URI of the broker that this client will connect to. |
void activemq::core::ActiveMQConnectionFactory::setBrokerURI | ( | const std::string & | uri | ) |
Sets the Broker URI that should be used when creating a new connection instance.
brokerURI | The string form of the Broker URI, this will be converted to a URI object. |
void activemq::core::ActiveMQConnectionFactory::setClientId | ( | const std::string & | clientId | ) |
Sets the Client Id.
clientId | - The new clientId value. |
void activemq::core::ActiveMQConnectionFactory::setCloseTimeout | ( | unsigned int | timeout | ) |
Sets the close timeout to use when sending the disconnect request.
timeout | - The time to wait for a close message. |
void activemq::core::ActiveMQConnectionFactory::setCompressionLevel | ( | int | value | ) |
Sets the Compression level used when Message body compression is enabled, a value of -1 causes the Compression Library to use the default setting which is a balance of speed and compression.
The range of compression levels is [0..9] where 0 indicates best speed and 9 indicates best compression.
value | A signed int value that controls the compression level. |
void activemq::core::ActiveMQConnectionFactory::setDispatchAsync | ( | bool | value | ) |
Should messages be dispatched synchronously or asynchronously from the producer thread for non-durable topics in the broker? For fast consumers set this to false.
For slow consumers set it to true so that dispatching will not block fast consumers. .
value | The value of the dispatch asynchronously option sent to the broker. |
void activemq::core::ActiveMQConnectionFactory::setExceptionListener | ( | cms::ExceptionListener * | listener | ) |
Set an CMS ExceptionListener that will be set on eat connection once it has been created.
The factory does not take ownership of this pointer, the client must ensure that its lifetime is scoped to the connection that it is applied to.
listener | The listener to set on the connection or NULL for no listener. |
void activemq::core::ActiveMQConnectionFactory::setMessagePrioritySupported | ( | bool | value | ) |
Set whether or not this factory should create Connection objects with the Message priority support function enabled.
value | Boolean indicating if Message priority should be enabled. |
void activemq::core::ActiveMQConnectionFactory::setPassword | ( | const std::string & | password | ) |
Sets the password that should be used when creating a new connection.
password | string |
void activemq::core::ActiveMQConnectionFactory::setPrefetchPolicy | ( | PrefetchPolicy * | policy | ) |
Sets the PrefetchPolicy instance that this factory should use when it creates new Connection instances.
The PrefetchPolicy passed becomes the property of the factory and will be deleted when the factory is destroyed.
policy | The new PrefetchPolicy that the ConnectionFactory should clone for Connections. |
void activemq::core::ActiveMQConnectionFactory::setProducerWindowSize | ( | unsigned int | windowSize | ) |
Sets the size in Bytes of messages that a producer can send before it is blocked to await a ProducerAck from the broker that frees enough memory to allow another message to be sent.
windowSize | - The size in bytes of the Producers memory window. |
void activemq::core::ActiveMQConnectionFactory::setRedeliveryPolicy | ( | RedeliveryPolicy * | policy | ) |
Sets the RedeliveryPolicy instance that this factory should use when it creates new Connection instances.
The RedeliveryPolicy passed becomes the property of the factory and will be deleted when the factory is destroyed.
policy | The new RedeliveryPolicy that the ConnectionFactory should clone for Connections. |
void activemq::core::ActiveMQConnectionFactory::setSendTimeout | ( | unsigned int | timeout | ) |
Sets the send timeout to use when sending Message objects, this will cause all messages to be sent using a Synchronous request is non-zero.
timeout | - The time to wait for a response. |
void activemq::core::ActiveMQConnectionFactory::setUseAsyncSend | ( | bool | value | ) |
Sets the useAsyncSend option.
value | - true to activate, false to disable. |
void activemq::core::ActiveMQConnectionFactory::setUseCompression | ( | bool | value | ) |
Sets whether Message body compression is enabled.
value | Boolean indicating if Message body compression is enabled. |
void activemq::core::ActiveMQConnectionFactory::setUsername | ( | const std::string & | username | ) |
Sets the username that should be used when creating a new connection.
username | string |
const std::string activemq::core::ActiveMQConnectionFactory::DEFAULT_URI [static] |