Lesson 1: Setting up client and server components

 Prepare your JMS provider
  1. Refer to your JMS server documentation to start the server.

  2. Create the following queues within your JMS server:

    • testmessage The TestMessage sample uses this queue name to listen for messages.
    • qanywhere_receive The QAnywhere JMS connector uses this queue name to listen for messages.

    You may need to restart the server after creating the queues. Refer to your JMS server documentation for more details.

 Start the QAnywhere client and server components
  1. Create a QAnywhere JMS connector for your JMS system using Sybase Central. See Setting up JMS connectors.

  2. At a command prompt, run the following command:

    mlsrv12 -m -c "dsn=QAnywhere 12 Demo" -sl
    java(-cp JMS-client-jar-files) -vcrs
    -zu+

    where JMS-client-jar-files is a semicolon delimited list of jar files that are required to access the JMS server. See your JMS server documentation for details.

    The MobiLink server starts for messaging.

  3. Click Start » Programs » SQL Anywhere 12 » QAnywhere » Tutorial using SQL Anywhere » QAnywhere Agent For SQL Anywhere -- saclient1.

    The QAnywhere Agent loads.

  4. Click Start » Programs » SQL Anywhere 12 » QAnywhere » Tutorial using SQL Anywhere » TestMessage -- saclient1.

    The QAnywhere sample application loads.

 Start the JMS version of the TestMessage client
  1. At a command prompt, run the following command:

    edit "%SQLANYSAMP12%/QAnywhere/JMS/TestMessage/build.bat"
  2. Examine the code in the build.bat file and ensure that your JMS server file paths are correct.

    For example, if you use EAServer, the default settings are defined under the easerver heading:

    :easerver
    REM For EAServer, compile with the following JAR files
    SET easerver_install=c:\program files\sybase\easerver6
    SET jmsjars=%easerver_install%\lib\eas-client-15.jar
    GOTO build_app

    If EAServer is not located in the c:\program files\sybase\easerver6 directory, update the easerver_install variable so that it points to the proper install directory. Make sure that the jmsjars variable points to the proper location of the JMS server jar files.

    If your JMS server is not listed, use the custom header settings defined near the beginning of the batch file to define your own JMS file path locations.

    When finished, save your changes and exit the editor.

  3. At a command prompt, run the following command to compile the JMS TestMessage client:

    build.bat JMS-server-name

    where JMS-server-name is the name of your JMS server represented as a header name in build.bat. Acceptable values are easerver, fioranomq, jboss, tibco, weblogic, and custom. By default, build.bat uses easerver.

  4. At a command prompt, run the following command:

    edit "%SQLANYSAMP12%/QAnywhere/JMS/TestMessage/run.bat"
  5. Examine the code in the run.bat file and ensure that your JMS server file paths are correct.

    For example, if you use EAServer, the default settings are defined under the easerver heading:

    :easerver
    REM For EAServer, compile with the following JAR files
    SET easerver_install=c:\program files\sybase\easerver6
    SET jmsjars=%easerver_install%\lib\eas-client-15.jar
    GOTO build_app

    If EAServer is not located in the c:\program files\sybase\easerver6 directory, update the easerver_install variable so that it points to the proper install directory. Make sure that the jmsjars variable points to the proper location of the JMS server jar files.

    If your JMS server is not listed, use the custom header settings defined near the beginning of the batch file to define your own JMS file path locations.

    When finished, save your changes and exit the editor.

  6. At a command prompt, run the following command to run the JMS TestMessage client:

    run.bat JMS-server-name

    where JMS-server-name is the name of your JMS server represented as a header name in build.bat. Acceptable values are easerver, fioranomq, jboss, tibco, weblogic, and custom. By default, build.bat uses easerver.

  7. Move the JMS TestMessage window to the right side of your screen under the existing saclient1 - TestMessage window.

  8. Proceed to Lesson 2: Sending a message from a JMS client to a QAnywhere client.