0
votes

I want high level steps to connect to remote JMS Provider.

I have some client application which wants to lookup in JNDI on FileSystem based to get the connection factory for JMS provider.

I understand that in JMS Administeration (MQ Explorer), we can create the Connection factories. This is creating .bindings file.How can I use this .bindings file into my client application system?

Should the Client Application system contain the JMS Administerator to create the .bindings in the same system or .bindings alone should be imported to the client system?

If Filesystem is used,then a path specifying the .binding is given as Provider url. This provider url (EG: F:/JMS) seems to be the path present in JMS Provider system.If .bindings file imported in client system, then how the client can recognise the path of .bindings file?

And What is the purpose of having ServerConnection channel in the Connection Factories definition when MQClient mode is used?When the JMS client connects through JNDI bindings, why Server Connection channel is required?

1

1 Answers

3
votes

Q1)

How can I use this .bindings file into my client application system? 

The .bindings file must be placed on file server that can be accessed by your client system. For example place the .bindings file on file server MyFileSvr's D:\JNDI-Directory folder. Then in your client machine D:\ folder must be mounted as a drive, say as F drive. Then in your application you can reference the .bindings file as

  // Instantiate the initial context
  String contextFactory = "com.sun.jndi.fscontext.RefFSContextFactory";
  Hashtable<String, String> environment = new Hashtable<String, String>();
  environment.put(Context.INITIAL_CONTEXT_FACTORY, contextFactory);
  environment.put(Context.PROVIDER_URL, "file:/F:/JNDI-Directory");
  Context context = new InitialDirContext(environment);
  System.out.println("Initial context found!");

  // Lookup the connection factory
  JmsConnectionFactory cf = (JmsConnectionFactory) context.lookup(connectionFactoryFromJndi);

Q2)

Should the Client Application system contain the JMS Administerator to create the .bindings in the same system?or .bindings alone should be imported to the client system? 

See the answer for Q1 above. It's good practice to keep the bindings file on a shared drive so that multiple client application can access.

Q3)

If Filesystem is used,then a path specifying the .binding is given as Provider url.This provider url (EG: F:/JMS) seems to be the path present in JMS Provider system.If .bindings file imported in client system,then how the client can recognise the path of .bindings file?

Again see answer for Q1.

Q4)

 And What is the purpose of having ServerConnection channel in the Connection Factories definition when MQClient mode is used? When the JMS client connects through JNDI bindings ,why Server Connection channel is required?

A server connection channel defines the required properties for MQ client applications (JMS or otherwise) connect to a IBM MQ queue manager. A connection factory object in JNDI bindings will have, among others,the following defined for an application to connect to a IBM MQ queue manager

1) Host name where queue manager is running

2) Port where queue manager is listening

3) Server Connection channel name.

4) Queue manager name.

Bottom line JNDI bindings and Server connection channel are not same.

Please read through online documentation of IBM MQ as well as MQ Redbooks.