Programmatically registering JMS administered objectsAdded by IBM on September 9, 2010 | Version 1 (Original)
|This section describes the steps to programmatically bind JMS administered objects to a JNDI repository.
This section describes the steps to programmatically bind JMS administered objects to a JNDI repository.
The JMS 1.1 administered objects are javax.jms/ConnectionFactory
, and javax.jms.Topic
Follow these steps to bind JMS administered objects to a JNDI repository:
- Create the JNDI initial context. This is automatically configured to access the Lotus® Expeditor JNDI provider.
InitialContext ic = new InitialContext();
- Create the ConnectionFactory. This ConnectionFactory allows connections to be created to a broker located at TCP/IP address 127.0.0.1, port 1883. Further properties can be declared using setStringProperty(), setBooleanProperty, and setIntegerProperty() as appropriate. For the full list of properties that can be specified, see ConnectionFactory properties.
JmsFactoryFactory f = JmsFactoryFactory.getInstance
( MQTTConstants.MQTT_PROVIDER_NAME );
JmsConnectionFactory cf = f.createConnectionFactory();
- Bind the ConnectionFactory to the JNDI repository
ic.bind( "jms/my_connection_factory", cf );
- Create the Topic. The Topic maps the name to which the JMS application refers to a JMS provider specific topic name. The JMS application refers to a topic called jms/my_topic, which maps to the provider-specific topic a/b/c.
JmsTopic t = f.createTopic("a/b/c");
- Bind the Topic to the JNDI repository
ic.bind( "jms/my_topic", t );
- Create the Queue. The Queue maps the name to which the JMS application refers to a JMS provider specific queue name. The JMS application refers to a queue called jms/my_queue, which maps to the provider-specific queue MyQueue.
JmsQueue q = f.createQueue("MyQueue");
- Bind the Queue to the JNDI repository
ic.bind( "jms/my_queue", q );
For more information, refer to the com.ibm.pvc.jndi.provider.java.binding extension point schema.
Parent topic: Registering JMS administered objects in JNDI: XPD622