activemq::core::ActiveMQConnection Class Reference

Concrete connection used for all connectors to the ActiveMQ broker. More...

#include <src/main/activemq/core/ActiveMQConnection.h>

Inheritance diagram for activemq::core::ActiveMQConnection:
Inheritance graph
[legend]

Public Member Functions

 ActiveMQConnection (const Pointer< transport::Transport > transport, const Pointer< decaf::util::Properties > properties)
 Constructor.
virtual ~ActiveMQConnection ()
virtual void addSession (Pointer< activemq::core::kernels::ActiveMQSessionKernel > session)
 Adds the session resources for the given session instance.
virtual void removeSession (Pointer< activemq::core::kernels::ActiveMQSessionKernel > session)
 Removes the session resources for the given session instance.
virtual void addProducer (Pointer< kernels::ActiveMQProducerKernel > producer)
 Adds an active Producer to the Set of known producers.
virtual void removeProducer (const Pointer< commands::ProducerId > &producerId)
 Removes an active Producer to the Set of known producers.
virtual void addDispatcher (const Pointer< commands::ConsumerId > &consumer, Dispatcher *dispatcher)
 Adds a dispatcher for a consumer.
virtual void removeDispatcher (const Pointer< commands::ConsumerId > &consumer)
 Removes the dispatcher for a consumer.
virtual void sendPullRequest (const commands::ConsumerInfo *consumer, long long timeout)
 If supported sends a message pull request to the service provider asking for the delivery of a new message.
bool isClosed () const
 Checks if this connection has been closed.
bool isStarted () const
 Check if this connection has been started.
bool isTransportFailed () const
 Checks if the Connection's Transport has failed.
virtual void destroyDestination (const commands::ActiveMQDestination *destination)
 Requests that the Broker removes the given Destination.
virtual void destroyDestination (const cms::Destination *destination)
 Requests that the Broker removes the given Destination.
bool isDuplicate (Dispatcher *dispatcher, Pointer< commands::Message > message)
 Allows Consumers to check if an incoming Message is a Duplicate.
void rollbackDuplicate (Dispatcher *dispatcher, Pointer< commands::Message > message)
 Mark message as received.
virtual const
cms::ConnectionMetaData
getMetaData () const
 Gets the metadata for this connection.
Returns:
the connection MetaData pointer ( caller does not own it ).
Exceptions:
CMSException if the provider fails to get the connection metadata for this connection.
See also:
ConnectionMetaData
Since:
2.0

virtual cms::SessioncreateSession ()
 Creates an AUTO_ACKNOWLEDGE Session.
Exceptions:
CMSException 

virtual std::string getClientID () const
 Get the Client Id for this session, the client Id is provider specific and is either assigned by the connection factory or set using the setClientID method.
Returns:
Client Id String for this Connection.
Exceptions:
CMSException if the provider fails to return the client id or an internal error occurs.

virtual void setClientID (const std::string &clientID)
 Sets the client identifier for this connection.The preferred way to assign a CMS client's client identifier is for it to be configured in a client-specific ConnectionFactory object and transparently assigned to the Connection object it creates.If a client sets the client identifier explicitly, it must do so immediately after it creates the connection and before any other action on the connection is taken. After this point, setting the client identifier is a programming error that should throw an IllegalStateException.
Parameters:
clientID The unique client identifier to assign to the Connection.
Exceptions:
CMSException if the provider fails to set the client id due to some internal error.
InvalidClientIDException if the id given is somehow invalid or is a duplicate.
IllegalStateException if the client tries to set the id after a Connection method has been called.

virtual cms::SessioncreateSession (cms::Session::AcknowledgeMode ackMode)
 Creates a new Session to work for this Connection using the specified acknowledgment mode.
Parameters:
ackMode the Acknowledgment Mode to use.
Exceptions:
CMSException 

virtual void close ()
 Closes this connection as well as any Sessions created from it (and those Sessions' consumers and producers).
Exceptions:
CMSException 

virtual void start ()
 Starts the service.
Exceptions:
CMSException if an internal error occurs while starting.

virtual void stop ()
 Stops this service.
Exceptions:
CMSException - if an internal error occurs while stopping the Service.

virtual cms::ExceptionListenergetExceptionListener () const
 Gets the registered Exception Listener for this connection.
Returns:
pointer to an exception listener or NULL

virtual void setExceptionListener (cms::ExceptionListener *listener)
 Sets the registered Exception Listener for this connection.
Parameters:
listener pointer to and ExceptionListener

virtual void setMessageTransformer (cms::MessageTransformer *transformer)
 Set an MessageTransformer instance that is passed on to all Session objects created from this Connection.The CMS code never takes ownership of the MessageTransformer pointer which implies that the client code must ensure that the object remains valid for the lifetime of the CMS object to which the MessageTransformer has been assigned.
Parameters:
transformer Pointer to the cms::MessageTransformer to set on all newly created Session objects.

virtual cms::MessageTransformergetMessageTransformer () const
 Gets the currently configured MessageTransformer for this Connection.
Returns:
the pointer to the currently set cms::MessageTransformer.

virtual cms::DestinationSourcegetDestinationSource ()
 Returns the DestinationSource} object which can be used to listen to destinations being created or destroyed or to enquire about the current destinations available on the message Provider.
Returns:
a new instance of a DestinationSource that is owned by the caller.
Exceptions:
CMSException if an error occurs while creating the destination source.

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.
void setDefaultClientId (const std::string &clientId)
 Sets the Client Id.
void setBrokerURL (const std::string &brokerURL)
 Sets the Broker URL that should be used when creating a new connection instance.
const std::string & getBrokerURL () const
 Gets the Broker URL that this factory will use when creating a new connection instance.
void setPrefetchPolicy (PrefetchPolicy *policy)
 Sets the PrefetchPolicy instance that this factory should use when it creates new Connection instances.
PrefetchPolicygetPrefetchPolicy () 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.
RedeliveryPolicygetRedeliveryPolicy () 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.
long long getNextTempDestinationId ()
 Get the Next Temporary Destination Id.
long long getNextLocalTransactionId ()
 Get the Next Temporary Destination Id.
bool isWatchTopicAdvisories () const
 Is the Connection configured to watch for advisory messages to maintain state of temporary destination create and destroy.
void setWatchTopicAdvisories (bool value)
 Sets whether this Connection is listening for advisory messages regarding temporary destination creation and deletion.
int getAuditDepth () const
 Get the audit depth for Messages for consumers when using a fault tolerant transport.
void setAuditDepth (int auditDepth)
 Set the audit depth for Messages for consumers when using a fault tolerant transport.
int getAuditMaximumProducerNumber () const
 The number of Producers that will be audited.
void setAuditMaximumProducerNumber (int auditMaximumProducerNumber)
 The number of Producers that will be audited.
bool isCheckForDuplicates () const
 Gets the value of the configured Duplicate Message detection feature.
void setCheckForDuplicates (bool checkForDuplicates)
 Gets the value of the configured Duplicate Message detection feature.
bool isTransactedIndividualAck () const
 when true, submit individual transacted acks immediately rather than with transaction completion.
void setTransactedIndividualAck (bool transactedIndividualAck)
 when true, submit individual transacted acks immediately rather than with transaction completion.
bool isNonBlockingRedelivery () const
 Returns true if non-blocking redelivery of Messages is configured for Consumers that are rolled back or recovered.
void setNonBlockingRedelivery (bool nonBlockingRedelivery)
 When true a MessageConsumer will not stop Message delivery before re-delivering Messages from a rolled back transaction.
long long getConsumerFailoverRedeliveryWaitPeriod () const
 Gets the delay period for a consumer redelivery.
void setConsumerFailoverRedeliveryWaitPeriod (long long value)
 Sets the delay period for a consumer redelivery.
bool isOptimizeAcknowledge () const
void setOptimizeAcknowledge (bool optimizeAcknowledge)
 Sets if Consumers are configured to use Optimized Acknowledge by default.
long long getOptimizeAcknowledgeTimeOut () const
 Gets the time between optimized ack batches in milliseconds.
void setOptimizeAcknowledgeTimeOut (long long optimizeAcknowledgeTimeOut)
 The max time in milliseconds between optimized ack batches.
long long getOptimizedAckScheduledAckInterval () const
 Gets the configured time interval that is used to force all MessageConsumers that have optimizedAcknowledge enabled to send an ack for any outstanding Message Acks.
void setOptimizedAckScheduledAckInterval (long long optimizedAckScheduledAckInterval)
 Sets the amount of time between scheduled sends of any outstanding Message Acks for consumers that have been configured with optimizeAcknowledge enabled.
bool isUseRetroactiveConsumer () const
 Should all created consumers be retroactive.
void setUseRetroactiveConsumer (bool useRetroactiveConsumer)
 Sets whether or not retroactive consumers are enabled.
bool isExclusiveConsumer () const
 Should all created consumers be exclusive.
void setExclusiveConsumer (bool exclusiveConsumer)
 Enables or disables whether or not queue consumers should be exclusive or not for example to preserve ordering when not using Message Groups.
bool isSendAcksAsync () const
 Returns whether Message acknowledgments are sent asynchronously meaning no response is required from the broker before the ack completes.
void setSendAcksAsync (bool sendAcksAsync)
 Sets whether Message acknowledgments are sent asynchronously meaning no response is required from the broker before the ack completes.
void addTransportListener (transport::TransportListener *transportListener)
 Adds a transport listener so that a client can be notified of events in the underlying transport, client's are always notified after the event has been processed by the Connection class.
void removeTransportListener (transport::TransportListener *transportListener)
 Removes a registered TransportListener from the Connection's set of Transport listeners, this listener will no longer receive any Transport related events.
virtual void onCommand (const Pointer< commands::Command > command)
 Event handler for the receipt of a non-response command from the transport.
virtual void onException (const decaf::lang::Exception &ex)
 Event handler for an exception from a command transport.
virtual void transportInterrupted ()
 The transport has suffered an interruption from which it hopes to recover.
virtual void transportResumed ()
 The transport has resumed after an interruption.
const commands::ConnectionInfogetConnectionInfo () const
 Gets the ConnectionInfo for this Object, if the Connection is not open than this method throws an exception.
const commands::ConnectionIdgetConnectionId () const
 Gets the ConnectionId for this Object, if the Connection is not open than this method throws an exception.
transport::TransportgetTransport () const
 Gets a reference to this object's Transport instance.
Pointer< threads::SchedulergetScheduler () const
 Gets a reference to the Connection objects built in Scheduler instance.
std::string getResourceManagerId () const
 Returns the Id of the Resource Manager that this client will use should it be entered into an XA Transaction.
void cleanup ()
 Clean up this connection object, reseting it back to a state that mirrors what a newly created ActiveMQConnection object has.
void oneway (Pointer< commands::Command > command)
 Sends a message without request that the broker send a response to indicate that it was received.
Pointer< commands::ResponsesyncRequest (Pointer< commands::Command > command, unsigned int timeout=0)
 Sends a synchronous request and returns the response from the broker.
void asyncRequest (Pointer< commands::Command > command, cms::AsyncCallback *onComplete)
 Sends a synchronous request and returns the response from the broker.
virtual void fire (const exceptions::ActiveMQException &ex)
 Notify the exception listener.
void setTransportInterruptionProcessingComplete ()
 Indicates that a Connection resource that is processing the transportInterrupted event has completed.
void setFirstFailureError (decaf::lang::Exception *error)
 Sets the pointer to the first exception that caused the Connection to become failed.
decaf::lang::ExceptiongetFirstFailureError () const
 Gets the pointer to the first exception that caused the Connection to become failed.
void onAsyncException (const decaf::lang::Exception &ex)
 Event handler for dealing with async exceptions.
void onClientInternalException (const decaf::lang::Exception &ex)
 Handles async client internal exceptions which don't usually affect the connection itself.
void checkClosed () const
 Check for Closed State and Throw an exception if true.
void checkClosedOrFailed () const
 Check for Closed State and Failed State and Throw an exception if either is true.
void ensureConnectionInfoSent ()
 If its not been sent, then send the ConnectionInfo to the Broker.
decaf::util::concurrent::ExecutorServicegetExecutor () const
void addTempDestination (Pointer< commands::ActiveMQTempDestination > destination)
 Adds the given Temporary Destination to this Connections collection of known Temporary Destinations.
void removeTempDestination (Pointer< commands::ActiveMQTempDestination > destination)
 Removes the given Temporary Destination to this Connections collection of known Temporary Destinations.
void deleteTempDestination (Pointer< commands::ActiveMQTempDestination > destination)
 Removes the given Temporary Destination to this Connections collection of known Temporary Destinations.
void cleanUpTempDestinations ()
 Removes any TempDestinations that this connection has cached, ignoring any exceptions generated because the destination is in use as they should not be removed.
bool isDeleted (Pointer< commands::ActiveMQTempDestination > destination) const
 Determines whether the supplied Temporary Destination has already been deleted from the Broker.

Protected Member Functions

virtual Pointer
< commands::SessionId
getNextSessionId ()
void disconnect (long long lastDeliveredSequenceId)
void waitForTransportInterruptionProcessingToComplete ()
void signalInterruptionProcessingComplete ()
const decaf::util::PropertiesgetProperties () const
void onControlCommand (Pointer< commands::Command > command)
void onConnectionControl (Pointer< commands::Command > command)
void onConsumerControl (Pointer< commands::Command > command)

Detailed Description

Concrete connection used for all connectors to the ActiveMQ broker.

Since:
2.0

Constructor & Destructor Documentation

activemq::core::ActiveMQConnection::ActiveMQConnection ( const Pointer< transport::Transport transport,
const Pointer< decaf::util::Properties properties 
)

Constructor.

Parameters:
transport The Transport requested for this connection to the Broker.
properties The Properties that were defined for this connection
virtual activemq::core::ActiveMQConnection::~ActiveMQConnection (  )  [virtual]

Member Function Documentation

virtual void activemq::core::ActiveMQConnection::addDispatcher ( const Pointer< commands::ConsumerId > &  consumer,
Dispatcher dispatcher 
) [virtual]

Adds a dispatcher for a consumer.

Parameters:
consumer - The consumer for which to register a dispatcher.
dispatcher - The dispatcher to handle incoming messages for the consumer.
Exceptions:
CMSException if an error occurs while removing performing the operation.
virtual void activemq::core::ActiveMQConnection::addProducer ( Pointer< kernels::ActiveMQProducerKernel producer  )  [virtual]

Adds an active Producer to the Set of known producers.

Parameters:
producer The Producer to add from the the known set.
Exceptions:
CMSException if an error occurs while removing performing the operation.
virtual void activemq::core::ActiveMQConnection::addSession ( Pointer< activemq::core::kernels::ActiveMQSessionKernel session  )  [virtual]

Adds the session resources for the given session instance.

Parameters:
session The session to be added to this connection.
Exceptions:
CMSException if an error occurs while removing performing the operation.
void activemq::core::ActiveMQConnection::addTempDestination ( Pointer< commands::ActiveMQTempDestination destination  ) 

Adds the given Temporary Destination to this Connections collection of known Temporary Destinations.

Parameters:
destination The temporary destination that this connection should track.
void activemq::core::ActiveMQConnection::addTransportListener ( transport::TransportListener transportListener  ) 

Adds a transport listener so that a client can be notified of events in the underlying transport, client's are always notified after the event has been processed by the Connection class.

Client's should ensure that the registered listener does not block or take a long amount of time to execute in order to not degrade performance of this Connection.

Parameters:
transportListener The TransportListener instance to add to this Connection's set of listeners to notify of Transport events.
void activemq::core::ActiveMQConnection::asyncRequest ( Pointer< commands::Command command,
cms::AsyncCallback onComplete 
)

Sends a synchronous request and returns the response from the broker.

This method converts any error responses it receives into an exception.

Parameters:
command The Command object that is to be sent to the broker.
onComplete Completion callback that will be notified on send success or failure.
Exceptions:
BrokerException if the response from the broker is of type ExceptionResponse.
ActiveMQException if any other error occurs while sending the Command.
void activemq::core::ActiveMQConnection::checkClosed (  )  const

Check for Closed State and Throw an exception if true.

Exceptions:
CMSException if the Connection is closed.
void activemq::core::ActiveMQConnection::checkClosedOrFailed (  )  const

Check for Closed State and Failed State and Throw an exception if either is true.

Exceptions:
CMSException if the Connection is closed or failed.
void activemq::core::ActiveMQConnection::cleanup (  ) 

Clean up this connection object, reseting it back to a state that mirrors what a newly created ActiveMQConnection object has.

void activemq::core::ActiveMQConnection::cleanUpTempDestinations (  ) 

Removes any TempDestinations that this connection has cached, ignoring any exceptions generated because the destination is in use as they should not be removed.

This method is useful for Connection pools that retain connection objects for long durations and want to periodically purge old temporary destination instances this connection is tracking.

virtual void activemq::core::ActiveMQConnection::close (  )  [virtual]

Closes this connection as well as any Sessions created from it (and those Sessions' consumers and producers).

Exceptions:
CMSException 

Implements cms::Connection.

virtual cms::Session* activemq::core::ActiveMQConnection::createSession ( cms::Session::AcknowledgeMode  ackMode  )  [virtual]

Creates a new Session to work for this Connection using the specified acknowledgment mode.

Parameters:
ackMode the Acknowledgment Mode to use.
Exceptions:
CMSException 

Implements cms::Connection.

Reimplemented in activemq::core::ActiveMQXAConnection.

virtual cms::Session* activemq::core::ActiveMQConnection::createSession (  )  [virtual]

Creates an AUTO_ACKNOWLEDGE Session.

Exceptions:
CMSException 

Implements cms::Connection.

void activemq::core::ActiveMQConnection::deleteTempDestination ( Pointer< commands::ActiveMQTempDestination destination  ) 

Removes the given Temporary Destination to this Connections collection of known Temporary Destinations.

Parameters:
destination The temporary destination that this connection should remove from the Broker.
Exceptions:
CMSException if the temporary destination is in use by an active Session.
virtual void activemq::core::ActiveMQConnection::destroyDestination ( const cms::Destination destination  )  [virtual]

Requests that the Broker removes the given Destination.

Calling this method implies that the client is finished with the Destination and that no other messages will be sent or received for the given Destination. The Broker frees all resources it has associated with this Destination.

Parameters:
destination The CMS Destination the Broker will be requested to remove.
Exceptions:
NullPointerException If the passed Destination is Null
IllegalStateException If the connection is closed.
UnsupportedOperationException If the wire format in use does not support this operation.
ActiveMQException If any other error occurs during the attempt to destroy the destination.
virtual void activemq::core::ActiveMQConnection::destroyDestination ( const commands::ActiveMQDestination destination  )  [virtual]

Requests that the Broker removes the given Destination.

Calling this method implies that the client is finished with the Destination and that no other messages will be sent or received for the given Destination. The Broker frees all resources it has associated with this Destination.

Parameters:
destination The Destination the Broker will be requested to remove.
Exceptions:
NullPointerException If the passed Destination is Null
IllegalStateException If the connection is closed.
UnsupportedOperationException If the wire format in use does not support this operation.
ActiveMQException If any other error occurs during the attempt to destroy the destination.
void activemq::core::ActiveMQConnection::disconnect ( long long  lastDeliveredSequenceId  )  [protected]
void activemq::core::ActiveMQConnection::ensureConnectionInfoSent (  ) 

If its not been sent, then send the ConnectionInfo to the Broker.

virtual void activemq::core::ActiveMQConnection::fire ( const exceptions::ActiveMQException ex  )  [virtual]

Notify the exception listener.

Parameters:
ex the exception to fire
int activemq::core::ActiveMQConnection::getAuditDepth (  )  const

Get the audit depth for Messages for consumers when using a fault tolerant transport.

The higher the value the more messages are checked for duplication, and the larger the performance impact of duplicate detection will be.

Returns:
the configured audit depth.
int activemq::core::ActiveMQConnection::getAuditMaximumProducerNumber (  )  const

The number of Producers that will be audited.

Returns:
the configured number of producers to include in the audit.
const std::string& activemq::core::ActiveMQConnection::getBrokerURL (  )  const

Gets the Broker URL that this factory will use when creating a new connection instance.

Returns:
brokerURL string
virtual std::string activemq::core::ActiveMQConnection::getClientID (  )  const [virtual]

Get the Client Id for this session, the client Id is provider specific and is either assigned by the connection factory or set using the setClientID method.

Returns:
Client Id String for this Connection.
Exceptions:
CMSException if the provider fails to return the client id or an internal error occurs.

Implements cms::Connection.

unsigned int activemq::core::ActiveMQConnection::getCloseTimeout (  )  const

Gets the assigned close timeout for this Connector.

Returns:
the close timeout configured in the connection uri
int activemq::core::ActiveMQConnection::getCompressionLevel (  )  const

Gets the currently configured Compression level for Message bodies.

Returns:
the int value of the current compression level.
const commands::ConnectionId& activemq::core::ActiveMQConnection::getConnectionId (  )  const

Gets the ConnectionId for this Object, if the Connection is not open than this method throws an exception.

Exceptions:
ActiveMQException if an error occurs while performing this operation.
const commands::ConnectionInfo& activemq::core::ActiveMQConnection::getConnectionInfo (  )  const

Gets the ConnectionInfo for this Object, if the Connection is not open than this method throws an exception.

Exceptions:
ActiveMQException if an error occurs while performing this operation.
long long activemq::core::ActiveMQConnection::getConsumerFailoverRedeliveryWaitPeriod (  )  const

Gets the delay period for a consumer redelivery.

Returns:
configured time delay in milliseconds.
virtual cms::DestinationSource* activemq::core::ActiveMQConnection::getDestinationSource (  )  [virtual]

Returns the DestinationSource} object which can be used to listen to destinations being created or destroyed or to enquire about the current destinations available on the message Provider.

Returns:
a new instance of a DestinationSource that is owned by the caller.
Exceptions:
CMSException if an error occurs while creating the destination source.

Implements cms::EnhancedConnection.

virtual cms::ExceptionListener* activemq::core::ActiveMQConnection::getExceptionListener (  )  const [virtual]

Gets the registered Exception Listener for this connection.

Returns:
pointer to an exception listener or NULL

Implements cms::Connection.

decaf::util::concurrent::ExecutorService* activemq::core::ActiveMQConnection::getExecutor (  )  const
Returns:
the ExecutorService used to run jobs for this Connection
decaf::lang::Exception* activemq::core::ActiveMQConnection::getFirstFailureError (  )  const

Gets the pointer to the first exception that caused the Connection to become failed.

Returns:
pointer to an Exception instance or NULL if none is set.
virtual cms::MessageTransformer* activemq::core::ActiveMQConnection::getMessageTransformer (  )  const [virtual]

Gets the currently configured MessageTransformer for this Connection.

Returns:
the pointer to the currently set cms::MessageTransformer.

Implements cms::Connection.

virtual const cms::ConnectionMetaData* activemq::core::ActiveMQConnection::getMetaData (  )  const [inline, virtual]

Gets the metadata for this connection.

Returns:
the connection MetaData pointer ( caller does not own it ).
Exceptions:
CMSException if the provider fails to get the connection metadata for this connection.
See also:
ConnectionMetaData
Since:
2.0

Implements cms::Connection.

long long activemq::core::ActiveMQConnection::getNextLocalTransactionId (  ) 

Get the Next Temporary Destination Id.

Returns:
the next id in the sequence.
virtual Pointer<commands::SessionId> activemq::core::ActiveMQConnection::getNextSessionId (  )  [protected, virtual]
Returns:
the next available Session Id.
long long activemq::core::ActiveMQConnection::getNextTempDestinationId (  ) 

Get the Next Temporary Destination Id.

Returns:
the next id in the sequence.
long long activemq::core::ActiveMQConnection::getOptimizeAcknowledgeTimeOut (  )  const

Gets the time between optimized ack batches in milliseconds.

Returns:
time between optimized ack batches in Milliseconds.
long long activemq::core::ActiveMQConnection::getOptimizedAckScheduledAckInterval (  )  const

Gets the configured time interval that is used to force all MessageConsumers that have optimizedAcknowledge enabled to send an ack for any outstanding Message Acks.

By default this value is set to zero meaning that the consumers will not do any background Message acknowledgment.

Returns:
the scheduledOptimizedAckInterval
const std::string& activemq::core::ActiveMQConnection::getPassword (  )  const

Gets the password that this factory will use when creating a new connection instance.

Returns:
password string, "" for default credentials
PrefetchPolicy* activemq::core::ActiveMQConnection::getPrefetchPolicy (  )  const

Gets the pointer to the current PrefetchPolicy that is in use by this ConnectionFactory.

Returns:
a pointer to this objects PrefetchPolicy.
unsigned int activemq::core::ActiveMQConnection::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.

Returns:
size in bytes of messages that this producer can produce before it must block and wait for ProducerAck messages to free resources.
const decaf::util::Properties& activemq::core::ActiveMQConnection::getProperties (  )  const [protected]
RedeliveryPolicy* activemq::core::ActiveMQConnection::getRedeliveryPolicy (  )  const

Gets the pointer to the current RedeliveryPolicy that is in use by this ConnectionFactory.

Returns:
a pointer to this objects RedeliveryPolicy.
std::string activemq::core::ActiveMQConnection::getResourceManagerId (  )  const

Returns the Id of the Resource Manager that this client will use should it be entered into an XA Transaction.

Returns:
a string containing the resource manager Id for XA Transactions.
Pointer<threads::Scheduler> activemq::core::ActiveMQConnection::getScheduler (  )  const

Gets a reference to the Connection objects built in Scheduler instance.

Returns:
a reference to a Scheduler instance owned by this Connection.
unsigned int activemq::core::ActiveMQConnection::getSendTimeout (  )  const

Gets the assigned send timeout for this Connector.

Returns:
the send timeout configured in the connection uri
transport::Transport& activemq::core::ActiveMQConnection::getTransport (  )  const

Gets a reference to this object's Transport instance.

Returns:
a reference to the Transport that is in use by this Connection.
const std::string& activemq::core::ActiveMQConnection::getUsername (  )  const

Gets the username that this factory will use when creating a new connection instance.

Returns:
username string, "" for default credentials
bool activemq::core::ActiveMQConnection::isAlwaysSyncSend (  )  const

Gets if the Connection should always send things Synchronously.

Returns:
true if sends should always be Synchronous.
bool activemq::core::ActiveMQConnection::isCheckForDuplicates (  )  const

Gets the value of the configured Duplicate Message detection feature.

When enabled and a fault tolerant transport is used (think failover) then this feature will help to detect and filter duplicate messages that might otherwise be delivered to a consumer after a connection failure.

Disabling this can increase performance since no Message auditing will occur.

Returns:
the checkForDuplicates value currently set.
bool activemq::core::ActiveMQConnection::isClosed (  )  const [inline]

Checks if this connection has been closed.

Returns:
true if the connection is closed
bool activemq::core::ActiveMQConnection::isDeleted ( Pointer< commands::ActiveMQTempDestination destination  )  const

Determines whether the supplied Temporary Destination has already been deleted from the Broker.

If watchTopicAdvisories is disabled this method will always return false.

Returns:
true if the temporary destination was deleted already.
bool activemq::core::ActiveMQConnection::isDispatchAsync (  )  const
Returns:
The value of the dispatch asynchronously option sent to the broker.
bool activemq::core::ActiveMQConnection::isDuplicate ( Dispatcher dispatcher,
Pointer< commands::Message message 
)

Allows Consumers to check if an incoming Message is a Duplicate.

Parameters:
dispatcher The Dispatcher that is checking the Message for Duplication.
message The Message that should be checked.
Returns:
true if the Message was seen before.
bool activemq::core::ActiveMQConnection::isExclusiveConsumer (  )  const

Should all created consumers be exclusive.

Returns:
true if consumer will be created with the exclusive flag set.
bool activemq::core::ActiveMQConnection::isMessagePrioritySupported (  )  const
Returns:
true if the Connections that this factory creates should support the message based priority settings.
bool activemq::core::ActiveMQConnection::isNonBlockingRedelivery (  )  const

Returns true if non-blocking redelivery of Messages is configured for Consumers that are rolled back or recovered.

Returns:
true if non-blocking redelivery is enabled.
bool activemq::core::ActiveMQConnection::isOptimizeAcknowledge (  )  const
Returns:
true if optimizeAcknowledge is enabled.
bool activemq::core::ActiveMQConnection::isSendAcksAsync (  )  const

Returns whether Message acknowledgments are sent asynchronously meaning no response is required from the broker before the ack completes.

Returns:
the sendAcksAsync configured value.
bool activemq::core::ActiveMQConnection::isStarted (  )  const [inline]

Check if this connection has been started.

Returns:
true if the start method has been called.
bool activemq::core::ActiveMQConnection::isTransactedIndividualAck (  )  const

when true, submit individual transacted acks immediately rather than with transaction completion.

This allows the acks to represent delivery status which can be persisted on rollback Used in conjunction with KahaDB set to Rewrite On Redelivery.

Returns:
true if this option is enabled.
bool activemq::core::ActiveMQConnection::isTransportFailed (  )  const [inline]

Checks if the Connection's Transport has failed.

Returns:
true if the Connection's Transport has failed.
bool activemq::core::ActiveMQConnection::isUseAsyncSend (  )  const

Gets if the useAsyncSend option is set.

Returns:
true if on false if not.
bool activemq::core::ActiveMQConnection::isUseCompression (  )  const

Gets if the Connection is configured for Message body compression.

Returns:
if the Message body will be Compressed or not.
bool activemq::core::ActiveMQConnection::isUseRetroactiveConsumer (  )  const

Should all created consumers be retroactive.

Returns:
true if consumer will be created with the retroactive flag set.
bool activemq::core::ActiveMQConnection::isWatchTopicAdvisories (  )  const

Is the Connection configured to watch for advisory messages to maintain state of temporary destination create and destroy.

Returns:
true if the Connection will listen for temporary topic advisory messages.
void activemq::core::ActiveMQConnection::onAsyncException ( const decaf::lang::Exception ex  ) 

Event handler for dealing with async exceptions.

Parameters:
ex The exception that caused the error condition.
void activemq::core::ActiveMQConnection::onClientInternalException ( const decaf::lang::Exception ex  ) 

Handles async client internal exceptions which don't usually affect the connection itself.

These are reported but do not shutdown the Connection.

Parameters:
error the exception that the problem
virtual void activemq::core::ActiveMQConnection::onCommand ( const Pointer< commands::Command command  )  [virtual]

Event handler for the receipt of a non-response command from the transport.

Parameters:
command the received command object.

Implements activemq::transport::TransportListener.

void activemq::core::ActiveMQConnection::onConnectionControl ( Pointer< commands::Command command  )  [protected]
void activemq::core::ActiveMQConnection::onConsumerControl ( Pointer< commands::Command command  )  [protected]
void activemq::core::ActiveMQConnection::onControlCommand ( Pointer< commands::Command command  )  [protected]
void activemq::core::ActiveMQConnection::oneway ( Pointer< commands::Command command  ) 

Sends a message without request that the broker send a response to indicate that it was received.

Parameters:
command The Command object to send to the Broker.
Exceptions:
ActiveMQException if not currently connected, or if the operation fails for any reason.
virtual void activemq::core::ActiveMQConnection::onException ( const decaf::lang::Exception ex  )  [virtual]

Event handler for an exception from a command transport.

Parameters:
ex The exception.

Implements activemq::transport::TransportListener.

virtual void activemq::core::ActiveMQConnection::removeDispatcher ( const Pointer< commands::ConsumerId > &  consumer  )  [virtual]

Removes the dispatcher for a consumer.

Parameters:
consumer - The consumer for which to remove the dispatcher.
Exceptions:
CMSException if an error occurs while removing performing the operation.
virtual void activemq::core::ActiveMQConnection::removeProducer ( const Pointer< commands::ProducerId > &  producerId  )  [virtual]

Removes an active Producer to the Set of known producers.

Parameters:
producerId - The ProducerId to remove from the the known set.
Exceptions:
CMSException if an error occurs while removing performing the operation.
virtual void activemq::core::ActiveMQConnection::removeSession ( Pointer< activemq::core::kernels::ActiveMQSessionKernel session  )  [virtual]

Removes the session resources for the given session instance.

Parameters:
session The session to be unregistered from this connection.
Exceptions:
CMSException if an error occurs while removing performing the operation.
void activemq::core::ActiveMQConnection::removeTempDestination ( Pointer< commands::ActiveMQTempDestination destination  ) 

Removes the given Temporary Destination to this Connections collection of known Temporary Destinations.

Parameters:
destination The temporary destination that this connection should stop tracking.
void activemq::core::ActiveMQConnection::removeTransportListener ( transport::TransportListener transportListener  ) 

Removes a registered TransportListener from the Connection's set of Transport listeners, this listener will no longer receive any Transport related events.

The caller is responsible for freeing the listener in all cases.

Parameters:
transportListener The pointer to the TransportListener to remove from the set of listeners.
void activemq::core::ActiveMQConnection::rollbackDuplicate ( Dispatcher dispatcher,
Pointer< commands::Message message 
)

Mark message as received.

Parameters:
dispatcher The Dispatcher instance that has received the Message.
message The Message that has been received.
virtual void activemq::core::ActiveMQConnection::sendPullRequest ( const commands::ConsumerInfo consumer,
long long  timeout 
) [virtual]

If supported sends a message pull request to the service provider asking for the delivery of a new message.

This is used in the case where the service provider has been configured with a zero prefetch or is only capable of delivering messages on a pull basis.

Parameters:
consumer - the ConsumerInfo for the requesting Consumer.
timeout - the time that the client is willing to wait.
Exceptions:
ActiveMQException if an error occurs while removing performing the operation.
void activemq::core::ActiveMQConnection::setAlwaysSyncSend ( bool  value  ) 

Sets if the Connection should always send things Synchronously.

Parameters:
value true if sends should always be Synchronous.
void activemq::core::ActiveMQConnection::setAuditDepth ( int  auditDepth  ) 

Set the audit depth for Messages for consumers when using a fault tolerant transport.

The higher the value the more messages are checked for duplication, and the larger the performance impact of duplicate detection will be.

Parameters:
auditDepth The configured audit depth.
void activemq::core::ActiveMQConnection::setAuditMaximumProducerNumber ( int  auditMaximumProducerNumber  ) 

The number of Producers that will be audited.

Parameters:
auditMaximumProducerNumber The configured number of producers to include in the audit.
void activemq::core::ActiveMQConnection::setBrokerURL ( const std::string &  brokerURL  ) 

Sets the Broker URL that should be used when creating a new connection instance.

Parameters:
brokerURL string
void activemq::core::ActiveMQConnection::setCheckForDuplicates ( bool  checkForDuplicates  ) 

Gets the value of the configured Duplicate Message detection feature.

When enabled and a fault tolerant transport is used (think failover) then this feature will help to detect and filter duplicate messages that might otherwise be delivered to a consumer after a connection failure.

Disabling this can increase performance since no Message auditing will occur.

Parameters:
checkForDuplicates The checkForDuplicates value to be configured.
virtual void activemq::core::ActiveMQConnection::setClientID ( const std::string &  clientID  )  [virtual]

Sets the client identifier for this connection.The preferred way to assign a CMS client's client identifier is for it to be configured in a client-specific ConnectionFactory object and transparently assigned to the Connection object it creates.If a client sets the client identifier explicitly, it must do so immediately after it creates the connection and before any other action on the connection is taken. After this point, setting the client identifier is a programming error that should throw an IllegalStateException.

Parameters:
clientID The unique client identifier to assign to the Connection.
Exceptions:
CMSException if the provider fails to set the client id due to some internal error.
InvalidClientIDException if the id given is somehow invalid or is a duplicate.
IllegalStateException if the client tries to set the id after a Connection method has been called.

Implements cms::Connection.

void activemq::core::ActiveMQConnection::setCloseTimeout ( unsigned int  timeout  ) 

Sets the close timeout to use when sending the disconnect request.

Parameters:
timeout - The time to wait for a close message.
void activemq::core::ActiveMQConnection::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.

Parameters:
value A signed int value that controls the compression level.
void activemq::core::ActiveMQConnection::setConsumerFailoverRedeliveryWaitPeriod ( long long  value  ) 

Sets the delay period for a consumer redelivery.

Parameters:
value The configured time delay in milliseconds.
void activemq::core::ActiveMQConnection::setDefaultClientId ( const std::string &  clientId  ) 

Sets the Client Id.

Parameters:
clientId - The new clientId value.
void activemq::core::ActiveMQConnection::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. .

Parameters:
value The value of the dispatch asynchronously option sent to the broker.
virtual void activemq::core::ActiveMQConnection::setExceptionListener ( cms::ExceptionListener listener  )  [virtual]

Sets the registered Exception Listener for this connection.

Parameters:
listener pointer to and ExceptionListener

Implements cms::Connection.

void activemq::core::ActiveMQConnection::setExclusiveConsumer ( bool  exclusiveConsumer  ) 

Enables or disables whether or not queue consumers should be exclusive or not for example to preserve ordering when not using Message Groups.

Parameters:
exclusiveConsumer The value of this configuration option.
void activemq::core::ActiveMQConnection::setFirstFailureError ( decaf::lang::Exception error  ) 

Sets the pointer to the first exception that caused the Connection to become failed.

Parameters:
pointer to the exception instance that is to be the first failure error if the first error is already set this value is deleted.
void activemq::core::ActiveMQConnection::setMessagePrioritySupported ( bool  value  ) 

Set whether or not this factory should create Connection objects with the Message priority support function enabled.

Parameters:
value Boolean indicating if Message priority should be enabled.
virtual void activemq::core::ActiveMQConnection::setMessageTransformer ( cms::MessageTransformer transformer  )  [virtual]

Set an MessageTransformer instance that is passed on to all Session objects created from this Connection.The CMS code never takes ownership of the MessageTransformer pointer which implies that the client code must ensure that the object remains valid for the lifetime of the CMS object to which the MessageTransformer has been assigned.

Parameters:
transformer Pointer to the cms::MessageTransformer to set on all newly created Session objects.

Implements cms::Connection.

void activemq::core::ActiveMQConnection::setNonBlockingRedelivery ( bool  nonBlockingRedelivery  ) 

When true a MessageConsumer will not stop Message delivery before re-delivering Messages from a rolled back transaction.

This implies that message order will not be preserved and also will result in the TransactedIndividualAck option to be enabled.

Parameters:
nonBlockingRedelivery The value to configure for non-blocking redelivery.
void activemq::core::ActiveMQConnection::setOptimizeAcknowledge ( bool  optimizeAcknowledge  ) 

Sets if Consumers are configured to use Optimized Acknowledge by default.

Parameters:
optimizeAcknowledge The optimizeAcknowledge mode to set.
void activemq::core::ActiveMQConnection::setOptimizeAcknowledgeTimeOut ( long long  optimizeAcknowledgeTimeOut  ) 

The max time in milliseconds between optimized ack batches.

Parameters:
optimizeAcknowledgeTimeOut The time in milliseconds for optimized ack batches.
void activemq::core::ActiveMQConnection::setOptimizedAckScheduledAckInterval ( long long  optimizedAckScheduledAckInterval  ) 

Sets the amount of time between scheduled sends of any outstanding Message Acks for consumers that have been configured with optimizeAcknowledge enabled.

Time is given in Milliseconds.

Parameters:
optimizedAckScheduledAckInterval The scheduledOptimizedAckInterval to use for new Consumers.
void activemq::core::ActiveMQConnection::setPassword ( const std::string &  password  ) 

Sets the password that should be used when creating a new connection.

Parameters:
password string
void activemq::core::ActiveMQConnection::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.

Parameters:
policy The new PrefetchPolicy that the ConnectionFactory should clone for Connections.
void activemq::core::ActiveMQConnection::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.

Parameters:
windowSize - The size in bytes of the Producers memory window.
void activemq::core::ActiveMQConnection::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.

Parameters:
policy The new RedeliveryPolicy that the ConnectionFactory should clone for Connections.
void activemq::core::ActiveMQConnection::setSendAcksAsync ( bool  sendAcksAsync  ) 

Sets whether Message acknowledgments are sent asynchronously meaning no response is required from the broker before the ack completes.

Parameters:
sendAcksAsync The sendAcksAsync configuration value to set.
void activemq::core::ActiveMQConnection::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.

Parameters:
timeout - The time to wait for a response.
void activemq::core::ActiveMQConnection::setTransactedIndividualAck ( bool  transactedIndividualAck  ) 

when true, submit individual transacted acks immediately rather than with transaction completion.

This allows the acks to represent delivery status which can be persisted on rollback Used in conjunction with KahaDB set to Rewrite On Redelivery.

Parameters:
transactedIndividualAck The value to set.
void activemq::core::ActiveMQConnection::setTransportInterruptionProcessingComplete (  ) 

Indicates that a Connection resource that is processing the transportInterrupted event has completed.

void activemq::core::ActiveMQConnection::setUseAsyncSend ( bool  value  ) 

Sets the useAsyncSend option.

Parameters:
value - true to activate, false to disable.
void activemq::core::ActiveMQConnection::setUseCompression ( bool  value  ) 

Sets whether Message body compression is enabled.

Parameters:
value Boolean indicating if Message body compression is enabled.
void activemq::core::ActiveMQConnection::setUseRetroactiveConsumer ( bool  useRetroactiveConsumer  ) 

Sets whether or not retroactive consumers are enabled.

Retroactive consumers allow non-durable topic subscribers to receive old messages that were published before the non-durable subscriber started.

Parameters:
useRetroactiveConsumer The value of this configuration option.
void activemq::core::ActiveMQConnection::setUsername ( const std::string &  username  ) 

Sets the username that should be used when creating a new connection.

Parameters:
username string
void activemq::core::ActiveMQConnection::setWatchTopicAdvisories ( bool  value  ) 

Sets whether this Connection is listening for advisory messages regarding temporary destination creation and deletion.

Parameters:
value Boolean indicating if advisory message monitoring should be enabled.
void activemq::core::ActiveMQConnection::signalInterruptionProcessingComplete (  )  [protected]
virtual void activemq::core::ActiveMQConnection::start (  )  [virtual]

Starts the service.

Exceptions:
CMSException if an internal error occurs while starting.

Implements cms::Startable.

virtual void activemq::core::ActiveMQConnection::stop (  )  [virtual]

Stops this service.

Exceptions:
CMSException - if an internal error occurs while stopping the Service.

Implements cms::Stoppable.

Pointer<commands::Response> activemq::core::ActiveMQConnection::syncRequest ( Pointer< commands::Command command,
unsigned int  timeout = 0 
)

Sends a synchronous request and returns the response from the broker.

This method converts any error responses it receives into an exception.

Parameters:
command The Command object that is to be sent to the broker.
timeout The time in milliseconds to wait for a response, default is zero or infinite.
Returns:
a Pointer instance to the Response object sent from the Broker.
Exceptions:
BrokerException if the response from the broker is of type ExceptionResponse.
ActiveMQException if any other error occurs while sending the Command.
virtual void activemq::core::ActiveMQConnection::transportInterrupted (  )  [virtual]

The transport has suffered an interruption from which it hopes to recover.

Implements activemq::transport::TransportListener.

virtual void activemq::core::ActiveMQConnection::transportResumed (  )  [virtual]

The transport has resumed after an interruption.

Implements activemq::transport::TransportListener.

void activemq::core::ActiveMQConnection::waitForTransportInterruptionProcessingToComplete (  )  [protected]

The documentation for this class was generated from the following file:

Generated on 1 Dec 2014 for activemq-cpp-3.8.2 by  doxygen 1.6.1