Sending QAnywhere messages

The following procedures describe how to send messages from QAnywhere applications. These procedures assume that you have created and opened a QAManager object.

Sending a message from your application does not ensure it is delivered from your device. It simply places the message on a queue to be delivered. The QAnywhere Agent performs the task of sending the message to the MobiLink server, which in turn delivers it to its destination.

For more information about when message transmission occurs, see Determining when message transmission should occur on the client.

To send a message (.NET)

  1. Create a new message.

    You can create either a text message or a binary message, using CreateTextMessage() or CreateBinaryMessage(), respectively.

    QATextMessage     msg;
    msg = mgr.CreateTextMessage();
  2. Set message properties.

    Use methods of the QATextMessage or QABinaryMessage class to set properties.

    See Introduction to QAnywhere messages.

  3. Put the message on the queue, ready for sending.

    mgr.PutMessage( "store-id\\queue-name", msg );

    where store-id and queue-name are strings that combine to form the destination address.

    See PutMessage method and Determining when message transmission should occur on the client.

To send a message (C++)

  1. Create a new message.

    You can create either a text message or a binary message, using createTextMessage() or createBinaryMessage(), respectively.

    QATextMessage *   msg;
    msg = mgr->createTextMessage();
  2. Set message properties.

    Use methods of the QATextMessage or QABinaryMessage class to set message properties.

    See Introduction to QAnywhere messages.

  3. Put the message on the queue, ready for sending.

    if( msg != NULL ) {
      if( !mgr->putMessage( "store-id\\queue-name", msg ) ) {
        // Display error using mgr->getLastErrorMsg().
        }
        mgr->deleteMessage( msg );
    }

    where store-id and queue-name are strings that combine to form the destination address.

    See putMessage function and Determining when message transmission should occur on the client.

To send a message (Java)

  1. Create a new message.

    You can create a text message or a binary message, using QAManagerBase.createTextMessage() or QAManagerBase.createBinaryMessage(), respectively.

    QATextMessage msg;
    msg = mgr.createTextMessage();
  2. Set message properties.

    Use QATextMessage or QABinaryMessage methods to set message properties.

    See Introduction to QAnywhere messages.

  3. Put the message on the queue.

    mgr.putMessage("store-id\\queue-name", msg);

See putMessage method and Determining when message transmission should occur on the client.

To send a message (SQL)

  1. Declare a variable to hold the message ID.

    begin
        declare @msgid varchar(128);
  2. Create a new message.

        set @msgid = ml_qa_createmessage();
  3. Set message properties.

    For more information, see Message properties.

  4. Put the message on the queue.

        call ml_qa_putmessage( @msgid, 'clientid\queuename' );
        commit;
    end

See ml_qa_putmessage and Determining when message transmission should occur on the client.


Implementing transactional messaging