Lesson 2: Run the TestMessage application

Background

TestMessage is a simple application that uses QAnywhere to send and receive text messages. Text messaging is used in this tutorial because it provides a simple and accessible demonstration of messaging. QAnywhere is, however, not just a text messaging system; it provides general purpose application-to-application messaging.

In this lesson, you are performing activities at a client. Typically, clients run on separate computers from the server.

In this lesson, you start the client message store that is part of the TestMessage sample. In Lesson 3, you use this message store to send a message to another client message store.

Activity

To start the QAnywhere Agent with the TestMessage client message store

  1. From the Start menu, choose Programs » SQL Anywhere 11 » QAnywhere » Tutorials Using SQL Anywhere » SQL Anywhere » QAnywhere Agent For SQLAnywhere - saclient1.

    This starts an instance of the QAnywhere Agent window. This Agent connects to the first TestMessage sample client message store and manages message transmission to and from this message store.

  2. Move the first QAnywhere Agent window to the right side of your screen, which represents the first client in this tutorial.

    Note

    You must allow a few seconds for the first instance of the QAnywhere Agent to start before you proceed to the next step.

  3. From the Start menu, choose Programs » SQL Anywhere 11 » QAnywhere » Tutorials Using SQL Anywhere » SQL Anywhere » QAnywhere Agent For SQLAnywhere - saclient2.

    This starts another instance of the QAnywhere Agent. This Agent connects to the second TestMessage sample client message store and manages message transmission to and from this message store.

  4. Move the second QAnywhere Agent window to the left side of your screen, which represents the second client in this tutorial.

  5. Each of the QAnywhere Agent windows displays a client message store ID, called saclient1 and saclient2.

To start TestMessage

  1. From the Start menu, choose Programs » SQL Anywhere 11 » QAnywhere » Tutorials Using SQL Anywhere » SQL Anywhere » TestMessage -- saclient1.

    The TestMessage window appears. The application is connected to the first TestMessage client message store that you started in the above procedure.

  2. Move the TestMessage window to the right side of your screen, together with the first QAnywhere Agent window. Both components belong on the first client.

  3. Check the message queue.

    From the Tools menu on the saclient1, choose Options. The queue name testmessage is specified. This is the queue that the TestMessage application is listening on for incoming messages. Do not change this name. Click Cancel

  4. From the Start menu, choose Programs » SQL Anywhere 11 » QAnywhere » Tutorials Using SQL Anywhere » SQL Anywhere » TestMessage -- saclient2.

    The TestMessage window appears. The application is connected to the second TestMessage client message store that you started in the above procedure.

  5. Move the TestMessage window to the left side of your screen, together with the second QAnywhere Agent. Both these components belong on the second client.

  6. Check the message queue.

    From the Tools menu on the saclient2, choose Options. The queue name testmessage is specified. This is the queue that the TestMessage application is listening on for incoming messages. Do not change this name. Click Cancel.

Discussion

You can configure the way that the QAnywhere Agent monitors messages by setting a message transmission policy. This sample is designed to only work with the automatic or scheduled policy, and it starts the QAnywhere Agent using the automatic policy. The QAnywhere policies are:

  • scheduled   This policy setting instructs the QAnywhere Agent to transmit messages periodically. If you don't specify an interval, the default is 15 minutes.

  • automatic   This default policy setting causes the QAnywhere Agent to transmit messages whenever a message to or from the client message store is ready for delivery.

  • on demand   This policy setting causes the QAnywhere Agent to transmit messages only when instructed to by an application.

  • custom   In this mode, you provide a set of rules to specify more complicated transmission behavior.

QAnywhere messages are delivered to a QAnywhere address, which consists of a client message store ID and a queue name. The default ID is the computer name on which the QAnywhere Agent is running. Each message store requires its own QAnywhere Agent. Each application can listen to multiple queues, but each queue should be specific to a single application.

See also