Before you can send or receive messages using QAnywhere C++ clients, you must complete the following initialization tasks.
Instead of creating a QAManager, you can create a QATransactionalManager. See Implementing transactional messaging for C++ clients.
Include the QAnywhere header file.
#include <qa.hpp> |
qa.hpp defines the QAnywhere classes.
Initialize QAnywhere.
To do this, initialize a factory for creating QAManager objects.
QAManagerFactory * factory; factory = QAnywhereFactory_init(); if( factory == NULL ) { // Fatal error. } |
For more information about QAManagerFactory, see QAManagerFactory class [QAnywhere C++].
Create a QAManager instance.
You can create a default QAManager object as follows:
QAManager * mgr; // Create a manager mgr = factory->createQAManager(); if( mgr == NULL ) { // fatal error } |
See QAManager class [QAnywhere C++].
For maximum concurrency benefits, multi-threaded applications should create a QAManager for each thread. See Multi-threading considerations.
You can customize a QAManager object programmatically or using a properties file.
To customize QAManager programmatically, use setProperty().
See Setting QAnywhere manager configuration properties programmatically.
To use a properties file, specify the properties file in createQAManager():
mgr = factory->createQAManager( "qa_mgr.props" ); |
where qa_mgr.props is the name of the properties file on the remote device.
See QAnywhere manager configuration property settings in a file.
Initialize the QAManager object.
qa_bool rc; rc=mgr->open( AcknowledgementMode::IMPLICIT_ACKNOWLEDGEMENT ); |
The argument to the open method is an acknowledgement mode, which indicates how messages are to be acknowledged. It must be one of IMPLICIT_ACKNOWLEDGEMENT or EXPLICIT_ACKNOWLEDGEMENT. With implicit acknowledgement, messages are acknowledged when they are received by the client. With explicit acknowledgement, you must call one of the acknowledge methods on the QAManager to acknowledge the message.
For more information about acknowledgement modes, see AcknowledgementMode class [QAnywhere C++].
You are now ready to send messages.
Discuss this page in DocCommentXchange.
|
Copyright © 2012, iAnywhere Solutions, Inc. - SQL Anywhere 12.0.1 |