简体   繁体   English

如何连接到远程JMS Provider?

[英]How to connect to remote JMS Provider?

I want high level steps to connect to remote JMS Provider. 我希望高层步骤连接到远程JMS Provider。

I have some client application which wants to lookup in JNDI on FileSystem based to get the connection factory for JMS provider. 我有一些客户端应用程序想要在基于FileSystem的JNDI中查找,以获得JMS提供程序的连接工厂。

I understand that in JMS Administeration (MQ Explorer), we can create the Connection factories. 我了解在JMS Administeration(MQ资源管理器)中,我们可以创建Connection工厂。 This is creating .bindings file.How can I use this .bindings file into my client application system? 这是在创建.bindings文件。如何在客户应用程序系统中使用此.bindings文件?

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? 客户端应用程序系统应该包含JMS管理员来在同一系统中创建.bindings还是应该单独将.bindings导入到客户端系统中?

If Filesystem is used,then a path specifying the .binding is given as Provider url. 如果使用文件系统,则将指定.binding的路径作为提供者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? 此提供程序URL(EG:F:/ JMS)似乎是JMS Provider系统中存在的路径。如果将.bindings文件导入客户端系统,那么客户端如何识别.bindings文件的路径?

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? 当使用MQClient模式时,在连接工厂定义中具有ServerConnection通道的目的是什么?当JMS客户端通过JNDI绑定进行连接时,为什么需要Server Connection通道?

Q1) 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. .bindings文件必须放置在客户端系统可以访问的文件服务器上。 For example place the .bindings file on file server MyFileSvr's D:\\JNDI-Directory folder. 例如,将.bindings文件放置在文件服务器MyFileSvr的D:\\ JNDI-Directory文件夹中。 Then in your client machine D:\\ folder must be mounted as a drive, say as F drive. 然后,必须在客户端计算机中将D:\\文件夹安装为驱动器,例如F驱动器。 Then in your application you can reference the .bindings file as 然后,在您的应用程序中,您可以将.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) 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) 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) 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. 服务器连接通道定义了连接到IBM MQ队列管理器的MQ客户机应用程序(JMS或其他)的必需属性。 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 JNDI绑定中的连接工厂对象将具有以下定义,以供应用程序连接到IBM MQ队列管理器

1) Host name where queue manager is running 1)运行队列管理器的主机名

2) Port where queue manager is listening 2)队列管理器正在侦听的端口

3) Server Connection channel name. 3)服务器连接通道名称。

4) Queue manager name. 4)队列管理器名称。

Bottom line JNDI bindings and Server connection channel are not same. 底线JNDI绑定和服务器连接通道不同。

Please read through online documentation of IBM MQ as well as MQ Redbooks. 请通读IBM MQ的在线文档以及MQ红皮书。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM