Ubik Batch Server Administration Guide

From UbikWiki

(Difference between revisions)
(Example)
(Example)

Line 214:

Line 214:

===== Example =====
===== Example =====
 +
<source lang="xml"><jndi-object>
 +
<localJndiName>jms/QueueMQSeries</localJndiName>
 +
<type>javax.jms.Queue</type>
 +
<distantJndiName>TEST.QUEUE</distantJndiName>
 +
<env-property>
 +
<name>java.naming.provider.url</name>
 +
<value>sv049002.si3si.int:1431/SYSTEM.DEF.SVRCONN</value>
 +
</env-property>
 +
<env-property>
 +
<name>java.naming.factory.initial</name>
 +
<value>com.ibm.mq.jms.context.WMQInitialContextFactory</value>
 +
</env-property>
 +
</jndi-object></source>
-
{| class="prettytable"
 
-
| <nowiki><jndi-object></nowiki>
 
- 
-
<nowiki><localJndiName>jms/QueueMQSeries</localJndiName></nowiki>
 
- 
-
<nowiki><type>javax.jms.Queue</type></nowiki>
 
- 
-
<nowiki><distantJndiName>TEST.QUEUE</distantJndiName></nowiki>
 
- 
-
<nowiki><env-property></nowiki>
 
- 
-
<nowiki><name>java.naming.provider.url</name></nowiki>
 
- 
-
<nowiki><value>sv049002.si3si.int:1431/SYSTEM.DEF.SVRCONN</value></nowiki>
 
- 
-
<nowiki></env-property></nowiki>
 
- 
-
<nowiki><env-property></nowiki>
 
- 
-
<nowiki><name>java.naming.factory.initial</name></nowiki>
 
- 
-
<nowiki><value>com.ibm.mq.jms.context.WMQInitialContextFactory</value></nowiki>
 
- 
-
<nowiki></env-property></nowiki>
 
- 
-
<nowiki></jndi-object></nowiki>
 
- 
-
|}
 
=== Using SUN FsContext ===
=== Using SUN FsContext ===
==== Libraries to add in business/lib folder ====
==== Libraries to add in business/lib folder ====

Revision as of 22:31, 21 March 2008

Contents

Server JMS configuration:

Our server integrates a JNDI connector that integrates in the local JNDI JMS objects from remote JNDIs.

It integrates a process that reconnects to the remote JNDIs during the lifetime of the server.

This enables startup even if remote objects are not yet available.

JMS Object (ConnectionFactories, Topics and Queues) are integrated in the local server JNDI using a configuration file:

  • <BATCH_SERVER_HOME>/config/jms-config.xml


JNDI Objects are composed of:


Element Description
localJndiName Physical name in the local JNDI (must be unique)
type One of:* javax.jms.ConnectionFactory
  • javax.jms.Queue
  • javax.jms.Topic


distantJndiName Physical name in the remote JNDI
env-property Element with 2 children:* name (Name of a JNDI property used to connect to the Remote JNDI)
  • value (Value of the JNDI property used to connect to the Remote JNDI)


env-property/name Name of the property, examples:* java.naming.provider.url
  • java.naming.factory.initial
  • java.naming.factory.url.pkgs
  • ...


env-property/value Value of the property

JMS Config DTD:

<!ELEMENT jndi-objects (jndi-object*) >
<!ELEMENT jndi-object (localJndiName, type, distantJndiName, env-property*) >
<!ELEMENT type (#PCDATA)>
<!ELEMENT localJndiName (#PCDATA)>
<!ELEMENT distantJndiName (#PCDATA)>
<!ELEMENT env-property (name, value) >
<!ELEMENT name (#PCDATA)>
<!ELEMENT value (#PCDATA)>

Example:

<jndi-objects>
  <jndi-object>
    <localJndiName>jms/localConnectionFactoryOJMS</localJndiName>
    <type>javax.jms.ConnectionFactory</type>
    <distantJndiName>demoConnectionFactoryOJMS</distantJndiName>
    <env-property>
      <name>java.naming.provider.url</name>
      <value>tcp://localhost:3035/</value>
    </env-property>
    <env-property>
      <name>java.naming.factory.initial</name>
      <value>org.exolab.jms.jndi.InitialContextFactory</value>
    </env-property>
  </jndi-object>
...
</jndi-objects>

Note about bindings:

To decouple coding process from deployment, developper should use logical names (start with java:comp/env/jms/localQueue).

To use physical name, just use jms/localQueue.


Deployer can then bind logical to physical names using <BAR_DISPLAY_NAME>-binding.xml, example:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE bar-resources PUBLIC "-//Ubik-Ingenierie //DTD BAR Binding Resource Configuration 1.0//EN" 
"http://www.ubik-ingenierie.com/consolebatch/config/bar-binding.dtd">
<bar-resources>
<bar-resource nameinbar="jdbc/toto" boundname="jdbc/batchweb" />
<bar-resource nameinbar="jdbc/batchweb" boundname="jdbc/batchweb" />
<bar-resource nameinbar="jms/localConnectionFactory" boundname="jms/localConnectionFactoryOJMS" />
<bar-resource nameinbar="jms/localDemoQueue" boundname="jms/localDemoQueueOJMS" />
</bar-resources>

If developer has used « java:comp/env/jms/localConnectionFactory » in his code, he will in fact use the object jms/localConnectionFactoryOJMS. If he chooses to use physical names (which is not recommended) he will use the name « jms/localConnectionFactoryOJMS». Note that if Batch Server administrator chooses to rename the resource, the code must be modified, while in the first solution, only binding file must be changed.

JMS Brokers:

ActiveMQ

Libraries to add in business/lib folder

  • activemq-core-4.1.1.jar
  • backport-util-concurrent-2.1.jar

JNDI

Attribute Value
java.naming.provider.url tcp://hostname:61616
java.naming.factory.initial org.apache.activemq.jndi.ActiveMQInitialContextFactory
More details
Example
<jndi-object>
    <localJndiName>jms/localConnectionFactoryAMQ</localJndiName>
    <type>javax.jms.ConnectionFactory</type>
    <distantJndiName>demoConnectionFactoryAMQ</distantJndiName>
    <env-property>
      <name>java.naming.provider.url</name>
      <value>tcp://hostname:61616</value>
    </env-property>
    <env-property>
      <name>java.naming.factory.initial</name>
      <value>org.apache.activemq.jndi.ActiveMQInitialContextFactory</value>
    </env-property>
  </jndi-object>

OpenJMS

Libraries to add in business/lib folder

  • openjms-common-0.7.7-beta-1.jar
  • openjms-0.7.7-beta-1.jar
  • openjms-net-0.7.7-beta-1.jar
  • spice-jndikit-1.2.jar (only if embedded JNDI is used)

JNDI

Attribute Value
java.naming.provider.url tcp://localhost:3035/
java.naming.factory.initial org.exolab.jms.jndi.InitialContextFactory
More details
Example
<jndi-object>
    <localJndiName>jms/localConnectionFactoryOJMS</localJndiName>
    <type>javax.jms.ConnectionFactory</type>
    <distantJndiName>demoConnectionFactoryOJMS</distantJndiName>
    <env-property>
      <name>java.naming.provider.url</name>
      <value>tcp://localhost:3035/</value>
    </env-property>
    <env-property>
      <name>java.naming.factory.initial</name>
      <value>org.exolab.jms.jndi.InitialContextFactory</value>
    </env-property>
  </jndi-object>

MQSeries 6.x

Note

MQSeries does not have an in-house JNDI.

You need to install:

  • support pac ME01 (WebSphere MQ Initial Context),
  • which in turn requires support pac MS0B (MQSeries Java classes for PCF)

Libraries to add in business/lib folder

  • mq-6.0.jar
  • mqjms-6.0.jar
  • mqcontext-6.0.jar
  • mqdhbcore-1.3.1.jar
  • com.ibm.mq.pcf-6.0.3.jar

JNDI

Attribute Value
java.naming.provider.url SERVER_HOST:1431/SYSTEM.DEF.SVRCONN
java.naming.factory.initial com.ibm.mq.jms.context.WMQInitialContextFactory
Example
<jndi-object>
    <localJndiName>jms/QueueMQSeries</localJndiName>
    <type>javax.jms.Queue</type>
    <distantJndiName>TEST.QUEUE</distantJndiName>
    <env-property>
      <name>java.naming.provider.url</name>
      <value>sv049002.si3si.int:1431/SYSTEM.DEF.SVRCONN</value>
    </env-property>
    <env-property>
      <name>java.naming.factory.initial</name>
      <value>com.ibm.mq.jms.context.WMQInitialContextFactory</value>
    </env-property>
  </jndi-object>

Using SUN FsContext

Libraries to add in business/lib folder

  • providerutil-1.2.jar
  • fscontext-1.2.jar

JNDI

Attribute Value
java.naming.provider.url file://C:\development\ubik\workspace\BrokerRunner\jndi
java.naming.factory.initial com.sun.jndi.fscontext.RefFSContextFactory
Example
<jndi-object>

<localJndiName>jms/QueueMQSeries</localJndiName>

<type>javax.jms.Queue</type>

<distantJndiName>TEST.QUEUE</distantJndiName>

<env-property>

<name>java.naming.provider.url</name>

<value>file://C:\development\ubik\workspace\BrokerRunner\jndi</value>

</env-property>

<env-property>

<name>java.naming.factory.initial</name>

<value>com.sun.jndi.fscontext.RefFSContextFactory</value>

</env-property>

</jndi-object>

Personal tools