首页 文章

如何连接到远程JMS提供程序?

提问于
浏览
0

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

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

据我所知,在JMS管理(MQ Explorer)中,我们可以创建Connection工厂 . 这是创建.bindings文件 . 如何将此.bindings文件用于我的客户端应用程序系统?

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

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

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

1 回答

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

    服务器连接通道定义连接到IBM MQ队列管理器的MQ客户机应用程序(JMS或其他)所需的属性 . JNDI绑定中的连接工厂对象将具有为应用程序连接到IBM MQ队列管理器定义的以下内容

    1)队列管理器正在运行的主机名

    2)队列管理器正在侦听的端口

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

    4)队列管理器名称 .

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

    请阅读IBM MQ以及MQ红皮书的在线文档 .

相关问题