Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SQL Anywhere 12.0.1 » QAnywhere » How to write QAnywhere client applications » Sending QAnywhere messages » Transactional messaging implementation


Implementing transactional messaging for .NET clients

 Create a transactional manager
  1. Initialize QAnywhere.

    This step is the same as in non-transactional messaging.

    using iAnywhere.QAnywhere.Client;
  2. Create a QATransactionalManager object.

    For example, to create a default QATransactionalManager object, invoke CreateQATransactionalManager:

    QATransactionalManager mgr = fact.CreateQATransactionalManager();  // no argument

    You can alternatively create a QATransactionalManager object that is customized using a properties file. The properties file is specified in the CreateQATransactionalManager method:

    QAManagerFactory fact = QAManagerFactory.Instance( "qa_mgr.props" );

    where qa_mgr.props is the name of the properties file that resides on the remote device.

  3. Initialize the QAManager object.


You are now ready to send messages. The following procedure sends two messages in a single transaction.

 Send multiple messages in a single transaction
  1. Initialize message objects.

    QATextMessage msg_1;
    QATextMessage msg_2;
  2. Send the messages.

    The following code sends two messages in a single transaction:

         msg_1 = mgr.CreateTextMessage();
         msg_2 = mgr.CreateTextMessage();
         mgr.PutMessage( "jms_1\\queue_name", msg_1 );
         mgr.PutMessage( "jms_1\\queue_name", msg_2 );

    The Commit method commits the current transaction and begins a new transaction. This method commits all PutMessage() method and GetMessage() method invocations.


    The first transaction begins with the call to open method.

 See also