Enable JMQ notification
From MsgServerDocWiki
How do I enable JMQ event notifications?
UPDATE, This information has been moved to http://wikis.sun.com/display/CommSuite/Enabling+JMQ+Notification+%28Example%29. Refer to that page from now on.
Sun Messaging Server 6.3 and above provides two mechanisms for event notifications. One mechanism is the older deprecated ENS event notification plugin (to be removed in future releases) and the second is the new JMQ (Java Message Queue) event notification plugin.
Details on JMQ integration can be found in Chapter 22. Configuring the JMQ Notification Plug-in to Produce Messages for Message Queue of the Sun Java System Messaging Server 6.3 Administration Guide
A tech article outlining the JMQ integration is also available.
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.
Contents |
[edit] 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.
[edit] 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 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
You should see something like the following in your imap log file (/opt/SUNWmsgsr/log/imap)
[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
[edit] Test the JMQ mechanism using the jmqclient
Run the supplied jmqclient software
Please note that 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)
...
[edit] 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
[edit] Reference links for JMQ
The following are a few links that may prove useful if you intend to produce a Java program to listen and process Messaging server events (rather then the C based jmqclient reference program used above):
- Java Message Service Tutorial
- Java Message Server Programming Interface
- Java Message Queue Developer's Guide for Java Clients
Categories: FAQ | Store

