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.

 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 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 QAManagerBase.PutMessage method [QAnywhere .NET] and Determining when message transmission should occur on the client.

 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 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 QAManagerBase.putMessage method [QAnywhere C++] and Determining when message transmission should occur on the client.

 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 QAnywhere messages.

  3. Put the message on the queue.

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

See QAManagerBase.putMessage method [QAnywhere Java] and Determining when message transmission should occur on the client.

 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.


Transactional messaging implementation