I need to know the arguments I need to pass to initialContex

Posted by appmath on 14-Oct-2012 11:05

Hello,

initialContext.listBindings("") returns everything.

I need to know the arguments I need to pass to get:

  1. Topics
  2. Queues
  3. QueueConnectionFactories
  4. TopicConnectionFactories

Thanks again,

Aziz

All Replies

Posted by pmeadows on 15-Oct-2012 05:14

JNDI is simply a mapping of names (ids) to arbitrary objects.  As far as I know you can't directly ask for objects of a certain type.  But you have a few options:

- standardise on a naming convention so you can tell from an

object's name what type of object it is

- sub-contexts might be a better alternative to the previous

option - if you put all your Topics in a specific sub-context

then you can list just those objects.  If you're using the

SMC's JMS Administered Objects tool, select a node in

the JNDI tree in the left-hand pane, then right-click to get

the 'Create Sub-Context' instruction.

- get everything, then test the resulting objects to determine

the type (e.g. 'obj instanceof javax.jms.Queue',

'obj instanceof javax.jms.ConnectionFactory', etc.)

Posted by appmath on 15-Oct-2012 12:02

Thank you Paul for your well-crafted answer.


I have already implemented the 3rd option and I felt that there must be a more elegant way.

The second option looks like the solution I was looking for but this an existing environment that I can't currently modify.

Aziz.

This thread is closed