#include <AmqHelper.h>
Public Member Functions | |
AmqHelper (const std::string &connectionstring="") | |
~AmqHelper () | |
void | connect (const string &queueManagerName="", const string &transportUri="", bool force=false) |
void | connect (const string &queueManagerName, const string &transportUri, const string &keyRepository, const string &sslCypherSpec, const string &sslPeerName, bool force=false) |
void | openQueue (bool syncpoint, const std::string &queueName="") |
void | openQueue (const std::string &queueName="") |
void | openBackoutQueue (const std::string &queueName) |
void | setBackupQueue (const std::string &queueName) |
long | getQueueDepth (const std::string &queueName="") |
Works only for small queues. More... | |
long | peek (const std::string &queueName="", bool first=true) |
void | setTimeout (int millisecs) |
long | getOne (bool getForClean=false) |
long | doGetOne (ManagedBuffer *buffer, bool getForClean, bool syncpoint=true) |
Get one message from the current queue and store it in a ManagedBuffer. More... | |
long | getOne (unsigned char *buffer, size_t maxSize, bool syncpoint=true) |
long | getGroupMessage (ManagedBuffer *groupMessageBuffer, const string &groupId, bool &isCleaningUp) |
void | putGroupMessage (ManagedBuffer *buffer, const string &batchId, long messageSequence, bool isLast) |
void | putOne (const ManagedBuffer &buffer, bool syncpoint=true) |
void | putOne (unsigned char *buffer, size_t bufferSize, bool syncpoint=true) |
void | putOne (unsigned char *buffer, size_t bufferSize, cms::Message &msg) |
void | putOne (cms::Message &msg, bool syncpoint=true) |
void | putOneRequest (unsigned char *buffer, size_t bufferSize, const std::string &rtqName, const std::string &rtbName, TransportReplyOptions &replyOptions) |
void | putOneReply (unsigned char *buffer, size_t bufferSize, long feedback, TRANSPORT_MESSAGE_TYPE messageType=TMT_REPLY) |
void | putOneReply (const ManagedBuffer &buffer, long feedback) |
void | putToDeadLetterQueue (cms::Message &msg, bool syncpoint=true) |
cms::Message * | createMsg () |
void | clearMessages () |
Clears all messages in the current queue. More... | |
void | setApplicationName (const std::string &applicationName) |
void | setMessageId (const std::string &messageId) |
void | setCorrelationId (const std::string &correlId) |
void | setGroupId (const std::string &groupId) |
void | setMessageFormat (const string &format) |
string | getLastMessageFormat () const |
time_t | getMessagePutTime () |
std::string | getLastReplyBrokerURI () const |
TRANSPORT_MESSAGE_TYPE | getLastMessageType () |
int | getLastSequenceId () const |
void | setSequenceId (int sequenceId) |
void | clearSSLOptions () |
void | reconnect () |
void | disconnect () |
bool | commit () |
Commits the current session. More... | |
bool | rollback () |
Rollbacks the current session. More... | |
TransportReplyOptions | getLastReplyOptions () const |
TODO getLastReplyOptions to return ReplyOptions type. More... | |
string | getApplicationName () const |
Set message header value when message end up in Dead.letter.queue. More... | |
std::string | getLastReplyQueueManager () const |
long | getOne (ManagedBuffer *buffer, bool syncpoint=true, bool keepJMSHeader=true) |
Pull one message from MQ Server and return it in 'ManagedBuffer* buffer'. More... | |
Public Member Functions inherited from FinTP::TransportHelper | |
virtual | ~TransportHelper () |
virtual void | putSAAmessage (const TransportReplyOptions &replyOptions, const string &replyQueue, ManagedBuffer *buffer, const string &batchId, long messageSequence, bool isLast) |
virtual void | putOneRequest (unsigned char *buffer, size_t bufferSize, const string &rtqName, const string &rtqmName, TransportReplyOptions &replyOptions)=0 |
virtual long | peek (const string &queue="", bool first=true)=0 |
virtual long | getQueueDepth (const string &queueName)=0 |
virtual void | setApplicationName (const string &applicationName)=0 |
string | getLastReplyQueue () const |
DEPRECATED (virtual void openQueue(const string &queueName)) | |
Common interface. More... | |
DEPRECATED (virtual void closeQueue()) | |
virtual long | getOne (ManagedBuffer *buffer) |
string | getLastMessageId () const |
virtual void | setMessageId (const string &messageId) |
string | getLastCorrelId () const |
virtual void | setCorrelationId (const string &correlId) |
string | getLastGroupId () const |
virtual void | setGroupId (const string &groupId) |
int | getLastGroupSequence () const |
void | setReplyUserData (const string &usrData) |
string | getReplyUserData () const |
time_t | getMessagePutTime () |
unsigned long | getLastMessageLength () const |
long long | getLastFeedback () const |
bool | isLastInGroup () const |
virtual void | setAutoAbandon (const int retries) |
virtual void | setBackupQueue (const string &queueName) |
long | getQueueDepth () |
Private Member Functions | |
int | noMessage () |
void | resetUsePassedIds () |
void | updateSelector (string &selector) |
void | writeToBuffer (ManagedBuffer &buffer, const unsigned char *rawBuffer) |
void | doConnect (const string &brokerURIName, bool force) |
bool | send (const string &queueName, cms::Message &msg, bool syncpoint=true) |
void | setConnectionBrokerURI () |
void | setLastMessageIds (const cms::Message &msg) |
Saves the message id, correlation id, group id, group sequence number, type and timestamp. More... | |
void | setLastMessageReplyData (const cms::Message &msg) |
int | setLastMessageInfo (cms::Message *msg, ManagedBuffer *buffer, bool browse=false, bool get=true, bool syncpoint=true) |
TRANSPORT_MESSAGE_TYPE | ToTransportMessageType (const string &messageType) |
std::string | ToString (TRANSPORT_MESSAGE_TYPE messageType) |
void | closeQueue () |
Private Attributes | |
activemq::core::ActiveMQConnection * | m_Connection |
cms::Session * | m_Session |
cms::Session * | m_AutoAcknowledgeSession |
cms::MessageConsumer * | m_Consumer |
cms::MessageConsumer * | m_AutoAcknowledgeConsumer |
cms::QueueBrowser * | m_QueueBrowser |
cms::MessageProducer * | m_Producer |
cms::MessageProducer * | m_AutoAcknowledgeProducer |
string | m_ReplyBrokerURI |
string | m_BackoutQueueName |
string | m_ConnectionString |
string | m_Selector |
TRANSPORT_MESSAGE_TYPE | m_MessageType |
long | m_ReplyOptions |
int | m_Timeout |
int | m_BrokerURIOpenRefCount |
long long | m_MessageCMSTimestamp |
const string * | m_MessageFormatPointer |
map< string, int > | m_GroupLogicOrder |
Static Private Attributes | |
static const string | FINTPGROUPID = "FinTPGroupId" |
static const string | FINTPGROUPSEQ = "FinTPGroupSeq" |
static const string | FINTPLASTINGROUP = "FinTPLastInGroup" |
Additional Inherited Members | |
Public Types inherited from FinTP::TransportHelper | |
enum | TRANSPORT_HELPER_TYPE { WMQ = 1, AMQ = 2, AQ = 3, NONE = 0 } |
enum | TRANSPORT_MESSAGE_TYPE { TMT_DATAGRAM = 0, TMT_REPLY = 1, TMT_REQUEST = 2, TMT_REPORT = 3 } |
Static Public Member Functions inherited from FinTP::TransportHelper | |
static TransportHelper * | CreateHelper (const TransportHelper::TRANSPORT_HELPER_TYPE &helperType) |
Factory method used to instantiate propper TransportHelper. More... | |
static TRANSPORT_HELPER_TYPE | parseTransportType (const string &transportType) |
static AbstractLogPublisher * | createMqLogPublisher (const NameValueCollection &propSettings, bool &isDefault) |
Static Public Attributes inherited from FinTP::TransportHelper | |
static const string | TMT_STRING = "TMT_STRING" |
static const string | TMT_RF_HEADER_2 = "TMT_RF_HEADER_2" |
static const string | TMT_NONE = "" |
Protected Member Functions inherited from FinTP::TransportHelper | |
TransportHelper (unsigned int messageIdLength) | |
Private ctor. More... | |
Protected Attributes inherited from FinTP::TransportHelper | |
const unsigned int | m_MessageIdLength |
string | m_QueueName |
string | m_MessageId |
string | m_CorrelationId |
string | m_GroupId |
int | m_GroupSequence |
bool | m_UsePassedMessageId |
bool | m_UsePassedCorrelId |
bool | m_UsePassedGroupId |
bool | m_UsePassedAppName |
string | m_MessagePutDate |
string | m_MessagePutTime |
string | m_ReplyQueue |
int | m_QueueOpenRefCount |
long long | m_Feedback |
bool | m_LastInGroup |
string | m_ReplyUsrData |
string | m_ApplicationName |
string | m_SSLKeyRepository |
string | m_SSLCypherSpec |
string | m_SSLPeerName |
unsigned int | m_MessageLength |
int | m_AutoAbandon |
string | m_BackupQueueName |
bool | m_SaveBackup |
|
explicit |
AmqHelper::~AmqHelper | ( | ) |
|
virtual |
Clears all messages in the current queue.
Implements FinTP::TransportHelper.
|
virtual |
Implements FinTP::TransportHelper.
|
private |
|
virtual |
Commits the current session.
Implements FinTP::TransportHelper.
|
virtual |
Implements FinTP::TransportHelper.
|
virtual |
Reimplemented from FinTP::TransportHelper.
Message * AmqHelper::createMsg | ( | ) |
|
virtual |
Implements FinTP::TransportHelper.
|
private |
long AmqHelper::doGetOne | ( | ManagedBuffer * | buffer, |
bool | getForClean, | ||
bool | syncpoint = true |
||
) |
Get one message from the current queue and store it in a ManagedBuffer.
buffer | Pointer to a ManagedBuffer used for storing the message data |
getForClean | Bool - true if the message is to be discarded without affecting the Helper's state |
|
inlinevirtual |
Set message header value when message end up in Dead.letter.queue.
Implements FinTP::TransportHelper.
|
virtual |
Implements FinTP::TransportHelper.
|
virtual |
Implements FinTP::TransportHelper.
|
inlinevirtual |
Implements FinTP::TransportHelper.
|
inline |
|
virtual |
TODO getLastReplyOptions to return ReplyOptions type.
Implements FinTP::TransportHelper.
|
inlinevirtual |
Implements FinTP::TransportHelper.
|
inline |
time_t AmqHelper::getMessagePutTime | ( | ) |
long AmqHelper::getOne | ( | bool | getForClean = false | ) |
|
virtual |
Implements FinTP::TransportHelper.
|
inlinevirtual |
Pull one message from MQ Server and return it in 'ManagedBuffer* buffer'.
Syncpoit participation is mandatory if transaction should be controlled by application Is method responsibility to set all ids for currently fetch message ( i.e m_MessageId, m_CorrelationId )
ManagedBuffer* | buffer:returned MQ message |
bool | syncpoint: true value, make the operation part of unit of work spanned over multiple operation |
bool | keepJMSHeader: true value, make MQ header part of buffer |
Implements FinTP::TransportHelper.
long AmqHelper::getQueueDepth | ( | const std::string & | queueName = "" | ) |
Works only for small queues.
For test purposes only.
queueName | String containing the queue's name |
|
private |
void AmqHelper::openBackoutQueue | ( | const std::string & | queueName | ) |
void FinTP::AmqHelper::openQueue | ( | bool | syncpoint, |
const std::string & | queueName = "" |
||
) |
void FinTP::AmqHelper::openQueue | ( | const std::string & | queueName = "" | ) |
long AmqHelper::peek | ( | const std::string & | queueName = "" , |
bool | first = true |
||
) |
|
virtual |
Implements FinTP::TransportHelper.
void AmqHelper::putOne | ( | const ManagedBuffer & | buffer, |
bool | syncpoint = true |
||
) |
|
virtual |
Implements FinTP::TransportHelper.
void FinTP::AmqHelper::putOne | ( | unsigned char * | buffer, |
size_t | bufferSize, | ||
cms::Message & | msg | ||
) |
void FinTP::AmqHelper::putOne | ( | cms::Message & | msg, |
bool | syncpoint = true |
||
) |
|
virtual |
Implements FinTP::TransportHelper.
void AmqHelper::putOneReply | ( | const ManagedBuffer & | buffer, |
long | feedback | ||
) |
void AmqHelper::putOneRequest | ( | unsigned char * | buffer, |
size_t | bufferSize, | ||
const std::string & | rtqName, | ||
const std::string & | rtbName, | ||
TransportReplyOptions & | replyOptions | ||
) |
void AmqHelper::putToDeadLetterQueue | ( | cms::Message & | msg, |
bool | syncpoint = true |
||
) |
void AmqHelper::reconnect | ( | ) |
|
private |
|
virtual |
Rollbacks the current session.
Implements FinTP::TransportHelper.
|
private |
void AmqHelper::setApplicationName | ( | const std::string & | applicationName | ) |
void AmqHelper::setBackupQueue | ( | const std::string & | queueName | ) |
|
inlineprivate |
void AmqHelper::setCorrelationId | ( | const std::string & | correlId | ) |
void AmqHelper::setGroupId | ( | const std::string & | groupId | ) |
|
private |
Saves the message id, correlation id, group id, group sequence number, type and timestamp.
msg | Reference to a CMS::Message |
|
private |
|
private |
|
virtual |
Implements FinTP::TransportHelper.
void AmqHelper::setMessageId | ( | const std::string & | messageId | ) |
void FinTP::AmqHelper::setSequenceId | ( | int | sequenceId | ) |
void AmqHelper::setTimeout | ( | int | millisecs | ) |
|
private |
|
private |
|
private |
|
private |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |