【问题标题】:How to connect to remote JMS Provider?如何连接到远程 JMS Provider?
【发布时间】:2014-11-23 08:31:06
【问题描述】:

我想要连接到远程 JMS 提供程序的高级步骤。

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

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

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

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

以及在使用MQClient模式时,Connection Factories定义中有ServerConnection通道的目的是什么?当JMS客户端通过JNDI绑定连接时,为什么需要Server Connection通道?

【问题讨论】:

    标签: jms ibm-mq


    【解决方案1】:

    第一季度)

    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);
    

    第二季度)

    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 的答案。最好将绑定文件保存在共享驱动器上,以便多个客户端应用程序可以访问。

    第三季度)

    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 的答案。

    第四季度)

     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 绑定和服务器连接通道不相同。

    请通读 IBM MQ 的在线文档以及 MQ 红皮书。

    【讨论】:

      猜你喜欢
      • 2014-04-17
      • 2016-07-17
      • 2015-01-25
      • 1970-01-01
      • 2021-03-24
      • 2020-09-13
      • 2011-07-26
      • 1970-01-01
      • 2011-02-01
      相关资源
      最近更新 更多