50 Enabling JMQ Event Notification (Example)

This example contains the following sections:

Details on JMQ integration can be found in the following pages:

Event Notifications in Messaging Server Overview

Oracle Communications Messaging Server supports two mechanisms for event notifications. One mechanism is the ENS event notification plugin. The second is the JMQ (Java Message Queue) event notification plugin.

The following is a quick-start guide on getting JMQ notifications working along with a sample program to show the output.

Enable Java Message Queue (JMQ)

  1. Modify the JMQ configuration file /etc/imq/imqbrokerd.conf.

    replace:
    
    AUTOSTART=NO
    
    with:
    
    AUTOSTART=YES
    
  2. Start Java Message Queue.

    /etc/init.d/imq start
    
  3. Reset the admin/guest password and add the jesuser account.

    cd /usr/bin
    imqusermgr update -u admin -p password
    Are you sure you want to update user admin? (y/n) y
    imqusermgr update -u guest -p guest
    Are you sure you want to update user guest? (y/n) y
    imqusermgr add -u jesuser -g user -p password
    User repository for broker instance: imqbroker
    User jesuser successfully added.
    

Configure and Enable the Messaging Server jmqnotify Plugin

  1. Enable the appropriate Messaging Server settings. In this example, the target is jmqnotify.

    cd /opt/sun/comms/messaging64/bin
    msconfig set notifytarget:jmqnotify.notifytype jmq
    msconfig set notifytarget:jmqnotify.newmsg 1
    msconfig set notifytarget:jmqnotify.updatemsg 1
    msconfig set notifytarget:jmqnotify.deletemsg 1
    msconfig set notifytarget:jmqnotify.maxheadersize 1024
    msconfig set notifytarget:jmqnotify.jmqhost "127.0.0.1"
    msconfig set notifytarget:jmqnotify.jmqport "7676"
    msconfig set notifytarget:jmqnotify.jmquser "jesuser"
    msconfig set notifytarget:jmqnotify.destinationtype "queue"
    msconfig set notifytarget:jmqnotify.jmqqueue "jesms"
    msconfig set notifytarget:jmqnotify.priority 3
    msconfig set notifytarget:jmqnotify.ttl 1000
    msconfig set notifytarget:jmqnotify.persistent 1
    
  2. Set the password for jmquser option, which in this example, is jesuser.

    msconfig
    msconfig> set -prompt notifytarget:jmqnotify.jmqpwd
    Password:
    Verify:
    msconfig# write
    msconfig> exit
    
  3. Restart Messaging Server.

    stop-msg
    start-msg
    
  4. Verify that the configuration is working by checking for an entry such as the following in the MessagingServer_home/log/imap log:

    [29/Oct/2012:15:45:38 -0700] ipg-test3 imapd[18062]: General Notice: JMQ notifications enabled: jmqnotify
    

Verify the JMQ Broker

You can verify that the JMQ software is operational at any time by running the following command:

cd /usr/bin
imqcmd query bkr -u admin
Password: password
Querying the broker specified by:

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

Version                                              4.4 Update 1
Instance Name                                        imqbroker
Broker ID
Primary Port                                         7676
Broker is Embedded                                   false
Instance Configuration/Data Root Directory           /var/imq

Current Number of Messages in System                 36
Current Total Message Bytes in System                19692

Current Number of Messages in Dead Message Queue     0
Current Total Message Bytes in Dead Message Queue    0

Log Dead Messages                                    false
Truncate Message Body in Dead Message Queue          true

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    unlimited (-1)
Auto Created Queue Max Number of Backup Consumers    0

Cluster ID
Cluster is Highly Available                          false
Cluster Broker List (active)                         mq://10.133.153.173:7676/
Cluster Broker List (configured)
Cluster Master Broker
Cluster URL

Log Level                                            WARNING
Log Rollover Interval (seconds)                      604800
Log Rollover Size (bytes)                            268435456

Successfully queried the broker.

You can also run this command:

imqcmd -u admin list dst
Listing all the destinations on the broker specified by:

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

--------------------------------------------------------------------------------------------
   Name     Type    State      Producers        Consumers                  Msgs
                            Total  Wildcard  Total  Wildcard  Count  Remote  UnAck  Avg Size
--------------------------------------------------------------------------------------------
jesms       Queue  RUNNING  24     -         0      -         0      0       0      0.0
mq.sys.dmq  Queue  RUNNING  0      -         0      -         0      0       0      0.0

Successfully listed destinations.

Related Information

Use the following links to find more information about producing a Java program to listen and process Messaging Server events: