![]() |
|
Pramati J2EE Server provides the Message Server in an easy-to-use and standard way in creating a Java-based implementation using the JMS adapter. This reduces the cost of purchasing an existing messaging product and the Java interface.
The JMS adapter provides an interface to other Message Servers that implement javax.jms to access the JMS resources, making it JMS-compliant. This enables seamless plug-in of an external JMS. This involves:
The JMS provider:
javax.jms.message in and out of the ServerJMS enables Java programs to create, send, receive, and read messages of an enterprise messaging system. A JMS application is made up of a set of application-defined messages and a set of clients that exchange them.
You can configure a JMS resource using resource-config.xml by adding a <jms-adapter _moz-userdefined=""> tag under the <jms-adapters _moz-userdefined=""> tag. The resource-config.xml appears as below:
<?xml version="1.0" encoding="UTF-8"?>
<DOCTYPE resource-service PUBLIC '-//Pramati Technologies //DTD Pramati Resource Service//EN'
'http://www.pramati.com/dtd/pramati-resource-service.dtd'>
<resource-service>
<resources>
<default-resources> </default-resources>
<datasources> </datasources>
<connection-factories> <connection-factories>
<mail-resources> <mail-resources>
<url-resources> <url-resources>
<jms-adapters>
<jms-adapter name="default" description="nodesc" interface-class="com.pramati.jms.client.JMSProviderImpl">
<properties>
<property name="java.naming.factory.initial" value="com.pramati.naming.client.PramatiClientContextFactory"/>
<property name="java.naming.provider.url" value="rmi://127.0.0.1:9191"/>
</properties>
<jms-resource bind-name="resJMSTopic" type="javax.jms.Topic" target-name="JMSTopic"/>
</jms-adapter>
</jms-adapters>
</resources>
</resource-service>
JMS Adapters are setup in a J2EE Server instance determining the connectivity to a Message Server (Embedded, Standalone, or HA-Message Server). JMS Adapters can be configured in resource-config.xml file of the J2EE Server (Standalone or cluster-node).
In case of non-embedded Message Server, that is when the JMS Service is not running in the same VM as the EJBService, specify com.pramati.naming.client.PramatiClientContextFactory for java.naming.factory.initial. Also specify the IP and port of the VM where the Message Server is running in resource-config.xml. In case of HA Message Server, provide the comma separated list of URLs of HA Message Server nodes.
<jms-adapters>
<jms-adapter name="default" description="nodesc" interface-class="com.pramati.jms.client.JMSProviderImpl">
<properties>
<property name="java.naming.factory.initial" value="com.pramati.naming.PramatiLocalContextFactory"/>
<property name="java.naming.provider.url" value="rmi://localhost:9191"/>
<properties>
<jms-adapter>
</jms-adapters>
jmshost is the host where the Standalone Message Server is running on Port 2099:
<jms-adapters>
<jms-adapter name="default" description="nodesc" interface-class="com.pramati.jms.client.JMSProviderImpl">
<properties>
<property name="java.naming.factory.initial" value="com.pramati.naming.client.PramatiClientContextFactory"/>
<property name="java.naming.provider.url" value="rmi://jmshost:2099"/>
<properties>
<jms-adapter>
<jms-adapters>
<jms-adapters>
<jms-adapter name="default" description="nodesc" interface-class="com.pramati.jms.client.JMSProviderImpl">
<properties>
<property name="java.naming.factory.initial" value="com.pramati.naming.client.PramatiClientContextFactory"/>
<property name="java.naming.provider.url" value="rmi://jms2:9191,rmi://jms1:9191"/>
<properties>
<jms-adapter>
<jms-adapters>
Note: For HA Message Server node or a Standalone Message Server node, the resource-config.xml should not contain any JMS Adapters.
To add a JMS adapter using the resource shell, on the resourceadmin:> prompt, enter resourceadmin:> add_jmsadapter
There are two ways to add a JMS adapter, using add_jmsadapter.
To use the interactive mode, enter add_jmsadapter, and press Enter. This asks for all the required fields one after the other. No special flag is required for this mode.
Enter the following values needed for the command resourceadmin:> add_jmsadapter
resourceadmin> - jms adapter name * #myJMSAdapter resourceadmin> - class name * #com.pramati.jms.client.JMSProviderImpl resourceadmin> - java.naming.factory.initial [com.pramati.naming.PramatiLocalContextFactory] #com.pramati.naming.PramatiLocalContextFactory resourceadmin> - java.naming.provider.url [rmi://localhost:2099] #rmi://localhost:9191 Adding JMS Server Adapter myJMSAdapter Initialized JMS Server Adapter [myJMSAdapter] Created JMS Server Adapter myJMSAdapter Added JMS Server Adapter [myJMSAdapter]
Note: Fields followed by * are mandatory. Press Enter for default values. Typing 'q' and pressing Enter at any point cancels the current command.
To use the non-interactive mode, enter add_jmsadapter. All the required attributes - the jmsAdapterName and the className in this case - have to be specified. All optional attributes have default values that can be modified. There are three ways in which you can specify the fields:
add_jmsadapter jmsAdapterName=myJMS className=com.pramati.jms.client.JMSProviderImpladd_jmsadapter myJMS com.pramati.jms.client.JMSProviderImpladd_jmsadapter -jmsAdapterName myJMS -className com.pramati.jms.client.JMSProviderImplTo remove a JMS adapter using the resource shell, enter the following command: remove_jmsadapter <name>
Once you have the Resource Service MBean, get the JMSServerAdapterManagerMBean by entering:
JMSServerAdapterManagerMBean jmsAdapter = resourceServiceMBean.getJMSServerAdapterManagerMBean();After this, call the
addJMSServerAdapter method on this MBean. The explanation of the parameters that are taken in the MBean are as follows:
public void addJMSServerAdapter(String name, String adapterClassName, Map initOptions)
To configure a JMS adapter using the Console, select Configure > Resources. This displays the Resources screen. If there are JMS resources added earlier, the JMS adapters section displays the following details:
Table 1: JMS adapter details
| Fields | Description |
|---|---|
| Name | The JNDI name of the JMS adapter. This is a mandatory field and must be unique. |
| XA Connection Factory | The XA datasource name, which provides connections that can participate in distributed transactions. |
| Queue | The number of messages sent by a valid JMS client waiting in queue. |
| Topic | The number of topics waiting to be processed. |
| Properties | Use Edit to modify and view the existing properties for the JMS adapter. |
| Add | Use Add to add a JMS adapter. |
| Delete | Use Delete to delete a JMS adapter. |
To add a JMS adapter:
Table 2: Details needed to add a JMS adapter
| Fields | Description |
|---|---|
| Name | Enter here the adapter name. This is a mandatory field. |
| Class | Enter here the class name of the interface and Server implementation, and is required for connecting to JMS. The default value is com.pramati.jms.client.JMSProviderImpl for Pramati JMS. This is a mandatory field. |
Table 3: Implementation properties of JMS adapters
| Fields | Description |
|---|---|
| Name | This is the property name and is not editable. |
| Value | Enter here the value of the property. The default values are already set in this field. |
| Description | Enter here a description for the class name property. |
After entering the values, click Next to reach Step 3 of adding a JMS adapter. On this page, set the JNDI names for XAConn Factory, Queue, and Topic. The JNDI name is used to bind the resource to the Server and is used to look up the destination within the JNDI namespace.
XAConn Factory, Queue, and Topic are JMS destinations to which the messages are sent and received. Provide all the above information and click Save. The JMS resource is added after the JMS starts. If the JMS is already running, the JMS resource is added immediately.
You cannot modify a JMS adapter after it has been created. To modify a JMS adapter, you need to delete it and recreate the resource. To edit a JMS resource for an existing adapter, click Edit against the adapter you want to modify. This displays the JMS Adapter Details screen.
You cannot edit the adapter class name and the properties field, but you can set the JNDI names for XAConn Factory, Queue, and Topic. Enter JNDI names against the respective fields, and click Save.
Select the JMS adapter to be deleted using the check box on the Resources page and click Delete.
Related Topics:
| © Pramati Technologies 2007 | Runs on Pramati Server | Feedback | Legal |