2014-09-29 36 views
0

我想要高级别的步骤来连接远程JMS提供程序。如何连接到远程JMS提供程序?

我有一些客户端应用程序想要在基于FileSystem的JNDI中查找以获取JMS提供程序的连接工厂。

我知道在JMS管理员(MQ Explorer)中,我们可以创建连接工厂。这是创建.bindings文件。我可以如何使用这个.bindings文件到我的客户端应用程序系统中?

客户端应用程序系统是否应该包含JMS管理员,以在同一个系统中创建.bindings,或者仅将.bindings应该导入到客户端系统?

如果使用Filesystem,则指定.binding的路径将作为Provider url提供。这个提供者URL(EG:F:/ JMS)似乎是JMS Provider系统中存在的路径。如果客户端系统导入了.bindings文件,那么客户端如何识别.bindings文件的路径?

当使用MQClient模式时,连接工厂定义中使用ServerConnection通道的目的是什么?当JMS客户端通过JNDI绑定连接时,为什么需要服务器连接通道?

回答

2

Q1)

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

的.bindings文件必须放在可通过客户端系统访问文件服务器上。例如,将.bindings文件放在文件服务器MyFileSvr的D:\ JNDI-Directory文件夹中。然后在你的客户端机器上D:\文件夹必须作为驱动器装入,例如F驱动器。然后在你的应用程序,您可以参考.bindings文件

// 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? 

见上面Q1答案。将绑定文件保留在共享驱动器上以便多个客户端应用程序可以访问是一种很好的做法。

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? 

再次看到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? 

甲服务器连接通道限定用于MQ客户端应用程序所要求的性能(JMS或其它)连接到一台IBM MQ队列管理器。在JNDI绑定连接工厂对象将有,除其他外,下面为应用程序定义为连接到一台IBM MQ队列管理器

1)主机名,其中队列管理器正在运行

2)端口,其中队列管理器正在监听

3)服务器连接通道名称。

4)队列管理器名称。

底线JNDI绑定和服务器连接通道不相同。

请仔细阅读在线文档以及MQ红皮书。