Sun GlassFish Message Queue 4.4 Developer's Guide for Java Clients

Starting and Testing a Message Broker

This tutorial assumes that you do not have a Message Queue message broker currently running. (If you run the broker as a UNIX startup process or Windows service, then it is already running and you can skip to Developing a Client Application.)

ProcedureTo Start a Broker

  1. In a terminal window, change to the directory containing Message Queue executables (see the table below).

    Installation Method 

    Location 

    IPS Image 

    IMQ_HOME/bin

    Solaris SVR4 packages 

    /usr/bin

    Linux RPM packages 

    /opt/sun/mq/bin

  2. Run the broker startup command (imqbrokerd) as follows:


    imqbrokerd -tty

    The -tty option causes all logged messages to be displayed to the terminal console (in addition to the log file). The broker will start and display a few messages before displaying the message


    imqbroker@host:7676 ready

    The broker is now ready and available for clients to use.

ProcedureTo Test a Broker

One simple way to check the broker startup is by using the Message Queue command utility (imqcmd) to display information about the broker:

  1. In a separate terminal window, change to the directory containing Message Queue executables (see the table shown at the beginning of the section To Start a Broker).

  2. Run imqcmd with the following arguments:


    imqcmd query bkr -u admin

    Supply the default password of admin when prompted to do so. The output displayed should be similar to that shown in the next example.


Example 1–1 Output From Testing a Broker


% imqcmd query bkr -u admin

Querying the broker specified by:

-------------------------
Host         Primary Port
-------------------------
localhost    7676

Version                                            3.6
Instance Name                                      imqbroker
Primary Port                                       7676

Current Number of Messages in System               0
Current Total Message Bytes in System              0

Max Number of Messages in System                   unlimited (-1)
Max Total Message Bytes in System                  unlimited (-1)
Max Message Size                                   70m


Auto Create Queues                                 true
Auto Create Topics                                 true
Auto Created Queue Max Number of Active Consumers  1
Auto Created Queue Max Number of Backup Consumers  0

Cluster Broker List (active)                        
Cluster Broker List (configured)                   
Cluster Master Broker                               
Cluster URL                                         

Log Level                                          INFO
Log Rollover Interval (seconds)                    604800
Log Rollover Size (bytes)                          unlimited (-1)

Successfully queried the broker.

Current Number of Messages in System        0