Enabling JMQ Event Notification (Example)
This example contains the following sections:
Details on JMQ integration can be found in the following pages:
- JMQ Notification Overview
- Configuring a JMQ Notification Service (Tasks and Examples)
- JMQ Notification Messages and Properties (Reference)
Event Notifications in Messaging Server Overview
Sun Messaging Server 6.3 and later provides two mechanisms for event notifications. One mechanism is the ENS event notification plugin. The second is the new 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. These steps were tested on a Single-Host Solaris 10u3 x86 installation. For details about that installation, see Deployment Example: Sun Java Communications Suite 6 on a Single Host.
Enable Java Message Queue (JMQ)
Modify the JMQ configuration file /etc/imq/imqbrokerd.conf.
replace: AUTOSTART=NO with: AUTOSTART=YES
Start Java Message Queue.
/etc/init.d/imq start
Reset admin/guest password & add 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
Enable the appropriate messaging server settings.
cd /opt/SUNWmsgsr/sbin ./configutil -o local.store.notifyplugin.jmqnotify.NewMsg.enable -v 1 ./configutil -o local.store.notifyplugin.jmqnotify.UpdateMsg.enable -v 1 ./configutil -o local.store.notifyplugin.jmqnotify.DeleteMsg.enable -v 1 ./configutil -o local.store.notifyplugin.jmqnotify.maxHeaderSize -v 1024 ./configutil -o local.store.notifyplugin.jmqnotify.jmqHost -v "127.0.0.1" ./configutil -o local.store.notifyplugin.jmqnotify.jmqPort -v "7676" ./configutil -o local.store.notifyplugin.jmqnotify.jmqUser -v "jesuser" ./configutil -o local.store.notifyplugin.jmqnotify.jmqPwd -v "password" ./configutil -o local.store.notifyplugin.jmqnotify.DestinationType -v "queue" ./configutil -o local.store.notifyplugin.jmqnotify.jmqQueue -v "jesms" ./configutil -o local.store.notifyplugin.jmqnotify.Priority -v 3 ./configutil -o local.store.notifyplugin.jmqnotify.ttl -v 1000 ./configutil -o local.store.notifyplugin.jmqnotify.Persistent -v 1
For Messaging Server 6.3 set the following:
./configutil -o local.store.notifyplugin -v '/opt/SUNWmsgsr/lib/libjmqnotify$jmqnotify'
For Messaging Server 7.0 and later, set the following:
./configutil -o local.store.notifyplugin -v '/opt/sun/comms/messaging/lib/libjmqnotify$jmqnotify'
Restart Messaging Server.
./stop-msg ./start-msg
Verify that the jmqplugin is working.
[25/Jul/2007:14:27:31 +1000] myhost imapd[18605]: General Notice: jmqNotify Loading plug-in $Id: jmqnotify.c,v 1.11.2.2 2006/03/03 23:25:07 pcoates Exp $: jmqnotify Jul 12 2007 20:05:44 [25/Jul/2007:14:27:31 +1000] myhost imapd[18605]: General Notice: jmqNotify readParams debugLevel=0 maxBodySize=0 maxHeaderSize=1028 hasNewMsg=1 hasUpdateMsg=1 hasReadMsg=1 hasDeleteMsg=1 hasPurgeMsg=1 jmqHost=127.0.0.1 jmqPort=7676 jmqQueue=jesms jmqUser=jesuser jmqPwd=password destinationtype=Queue Priority=3 ttl=1000 Persistent = 1
Test the JMQ Mechanism By Using the jmqclient
Run the supplied jmqclient software.
The original source code (jmqclient.c) is available in the same directory as the binary and can provide you with a basis for your own Messaging event handling software.
cd /opt/SUNWmsgsr/examples/jmqsdk/ chmod u+x jmqclient export LD_LIBRARY_PATH=/opt/SUNWmsgsr/lib/ ./jmqclient -u jesuser -w password -q jesms
Send a test email with the above software running, you should see output similar to the following:
message is persistent
Event type=NewMsg
timestamp=Wed Jul 25 14:30:40 2007
hostname=myhost
process=tcp_lmtp_server
pid=18618
mailboxName=testuser
uidValidity=1177041110
imapUID=120
size=931
hdrLen=920
numMsgs=69
numSeen=0
numDeleted=62
numSeenDeleted=5
Received message: Received: from conversion_peruser-daemon.myhost.sun.com by myhost.sun.com
(Sun Java(tm) System Messaging Server 6.3-3.01 (built Jul 12 2007; 32bit))
id <0JLP00E00WJ4DC00@myhost.sun.com> for test.user@sun.com; Wed,
25 Jul 2007 14:30:40 +1000 (EST)
...
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
Related Information
Use the following links to find more information about producing a Java program to listen and process Messaging Server events (rather then the C based jmqclient reference program used previously):


Comments (1)
Jun 18, 2008
nate_keegan says:
The comment below applies if you have Convergence installed on the same host as ...The comment below applies if you have Convergence installed on the same host as Messaging Server with JMQ:
http://wikis.sun.com/display/CommSuite/Configuring+JMS+Support+for+Calendar+Server+Alerts?focusedCommentId=18845427#comment-18845427