JMQ (Java Message Queue)

JMQ is a JMS implementation from Sun Microsystems that supports both PTP and Pub/Sub models, and is written in pure Java. JMQ is available under various "Try & Buy" deals from http://www.sun.com/workshop/jmq. There are three forms of this product available:

  • Developer Edition
    This version is available free of cost for development. The software distribution includes the following:

    • JMS implementation classes

    • Client runtime

    • 5-connection router

    • Development license for single router instance

    • Different command-line utilities for configuring Administered objects, administering users, monitoring, etc.

    • Client authentication server for development

    • Sample applications and online documentation

  • Business Edition
    This edition provides unlimited user connection for a single router instance running on a single host as well as all the features available for the developer edition

  • Business 10-pack Edition
    This is same as the business edition, but provides licensing for ten instances of the router either running on the same host or across multiple hosts

Product Features

JMQ provides a simple, powerful, and flexible messaging solution:

  • JMQ can be run on both Windows (NT and 2000) and Unix (Solaris SPARC) platforms. It can run with JDK 1.1.8 or Java 2 Platform.

  • JMQ is compliant with JMS 1.02 and supports the following features as specified in the JMS specification:

    • Publish/Subscribe messaging model

    • Point-to-Point messaging model

    • Certified message delivery

  • JMQ provides access to JMS Administered objects through JNDI (Java Naming and Directory Interface). It supports LDAP (Lightweight Directory Access Protocol) and file system service providers. JMQ comes with a command-line utility for configuring Administered objects.

  • JMQ supports fully connected multi-router network where routers are connected to each other through a single hub.

  • JMQ provides utilities for remotely administering the router and provides facilities for debugging, monitoring, administering users, etc.

JMQ Binaries

JMQ comes with a set of binaries for running the router, administering the users, configuring Administered objects, monitoring, etc.

irouter

The irouter binary is used for routing the messages delivered by JMS applications to other JMS applications and routers. This can be found in the bin directory of the JMQ installation. The screenshot below shows an instance of JMQ router up and running:

click to expand

Note 

Please refer to the JMQ deployment documentation for the different command-line options available for running the router.

irmon

This utility can be found in the bin directory of the JMQ installation and is used for monitoring the debugging information and network output. JMQ provides an exhaustive set of options for debugging and monitoring the router.

ircmd

This utility enables the users to perform administrative tasks on the router. The user can query connection information, control monitor and debug options, etc. The screenshot shows running the ircmd with the help command executed:

click to expand

jmqconfig

This utility can be used for configuring and storing the JMS Administered objects. This can be used for storing, deleting, viewing, and listing the destinations and connection factories in a JNDI namespace. The jmqconfig utility provides various command-line options for specifying the type of the Administered object, the JNDI service provider, initial context factory, etc. The screenshot below shows the use of jmqconfig to store a queue named myQueue in the file system provider context at the location c:\temp:

click to expand

jmqadmin

This is used for running the graphical administration console for performing the following tasks:

  • Deleting queues and their persistent messages

  • Administering users

  • Security authentication

  • Managing logs etc.

The utility doesn't let you delete durable topics. JMQ also provides a simple and non-encrypted client authentication server for development that can be administered using the administration console. The figure below shows the main screen for the administration console:

click to expand

Running the Portable JMS Client

The topic and topic connection factory are stored in the WinNT file system context for JMQ (we could also use LDAP; see jmqconfig earlier in the appendix).

Configuring the Administered Objects

We will be storing the Administered objects under the directory C:\temp in the WinNT file system context for the Java Message Queue. The JMQ implementations for the interfaces for topic and topic connection factory can be created and stored in a JNDI namespace using the jmqconfig tool explained earlier. Run the following command to store the topic myTopic in the WinNT file system context:

     "%JMQ_HOME%\bin\jmqconfig" -a -t t -n myTopic -o "name=myTopic" -i     "com.sun.jndi.fscontext.RefFSContextFactory" -u "file:C:/temp" 

  • The -a option is for adding an object.

  • The -t option specifies the type:

    • t - Topic

    • q - Queue

    • tf - Topic connection factory

    • qf - Queue connection factory

  • The option -n defines the JNDI name of the object.

  • The option -o is used for specifying different properties specific to destinations and connection factories. In the above example it is used to specify the name of the topic in JMQ. This is different from the JNDI name.

  • The option -i specifies the JNDI initial context factory.

  • The option -u specifies the JNDI service provider URL.

The following command can be used for storing the topic connection factory TCFactory:

     "%JMQ_HOME%\bin\jmqconfig" -a -t tf -n TCFactory -o "host=localhost" -i     "com.sun.jndi.fscontext.RefFSContextFactory" -u "file:C:/temp" 

Here the -o option is used to specify the host on which the message broker will be running.

Running the Client

For running the client, first start the JMQ router by running the irouter binary as explained in one of the previous sections. Now invoke the Java interpreter on the class PortableJMSClient with all the required classes in the classpath and passing the JNDI provider URL and the JNDI initial context factory as command-line arguments.

The required JAR files can all be found in the JMQ installation library:

  • jms.jar

  • jmq.jar - This JAR file contains JMQ's JMS implementation classes

  • fscontext.jar and providerutil.jar — These JAR files contain the required SPI classes for the JNDI file system context

The following command-line arguments should be passed to the program for running the client:

  • com.sun.jndi.fscontext.RefFSContextFactory — This is the initial context factory for the JNDI file system context

  • file:C:/temp - This is the JNDI service provider URL

Important 

In Java file protocol URLs, the file separator can be forward or backward.

The screenshot below shows the JMS client running against JMQ:

click to expand



Professional JMS
Professional JMS
ISBN: 1861004931
EAN: 2147483647
Year: 2000
Pages: 154

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net