2014-09-29 70 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紅皮書。