2017-08-05 8 views
0

私はIBM MQの初心者です。基本的には、Client(Eclipse Paho)とIBM MQ Queue Managerの間の接続を確立したいと考えています。Eclipse PahoとIBM Websphere MQとの接続が確立されていません

私は、次の手順を実行した:

  • 私はキュー・マネージャー
  • 作成されたIBMのMQ v.9.0
  • は、ポート番号(1414)とのサービスとしてキュー・マネージャーを開始しましインストールされています
  • サーバーチャネルを作成し、これを作成したキューマネージャに割り当てます。クライアント側で

:MQTT Javaクライアントである

  • Downloadd EclipseのPAHO、。
  • 開始キューマネージャーに接続するための小さなプログラムを試してください。

Followinigはプログラムです。

import java.util.logging.Logger; 

import org.eclipse.paho.client.mqttv3.MqttAsyncClient; 
import org.eclipse.paho.client.mqttv3.MqttClient; 
import org.eclipse.paho.client.mqttv3.MqttConnectOptions; 
import org.eclipse.paho.client.mqttv3.MqttException; 
import org.eclipse.paho.client.mqttv3.persist.MemoryPersistence; 

public class MQMTTFactory { 

    private static Logger log = Logger.getLogger(MQMTTFactory.class.getName()); 
    private MQMTTFactory() { 

    } 

    static final String BROKER_URL = "tcp://<<Ipaddress>>:1234"; 
    static final String M2MIO_DOMAIN = "<Insert m2m.io domain here>"; 
    static final String M2MIO_STUFF = "things"; 
    static final String M2MIO_USERNAME = "Guest"; 
    static final String M2MIO_PASSWORD_MD5 = "<m2m.io password (MD5 sum of password)>"; 
    static MqttClient myClient = null; 

    public static MqttClient getMqttClient() { 
     MqttConnectOptions connOpt; 
     if (myClient == null) { 
      connOpt = new MqttConnectOptions(); 
      connOpt.setCleanSession(true); 
      connOpt.setKeepAliveInterval(3000); 
      connOpt.setUserName(M2MIO_USERNAME); 
      // connOpt.setPassword(M2MIO_PASSWORD_MD5.toCharArray()); 

      // Connect to Broker 
      try { 
       myClient = new MqttClient(BROKER_URL, 
         MqttAsyncClient.generateClientId(), new MemoryPersistence()); 
       myClient.connect(connOpt); 
      } catch (MqttException e) { 
       log.severe("Client connection to the MQTT Broker is failed"); 
       e.printStackTrace(); 
       System.exit(-1); 
      } 
     } 
     return myClient; 

    } 

} 

ただし、上記のプログラムはサーバーとの接続の確立に失敗しました。 上記のプログラムの実行中に以下のエラーが発生しました。

Unable to connect to server (32103) - java.net.ConnectException: Connection refused: connect 

何が間違っているか教えてください。または任意の提案。

+1

を取得するには、次の2件の記事を読むことをお勧め

は、エラーのqmgrs/QMGRNAMEディレクトリの下にあるチェックAMQERR01.LOGましたか?リスナーが実行されていますか?どのチャンネルタイプを定義しましたか? – JoshMc

答えて

0

Eclipse Pahoクライアントは、MQTTプロトコルでのみ動作します。これはトピックベースのpub/subプロトコルであり、メッセージキューはサポートしていません。

IBM-MQはMQTTをサポートできますが、デフォルトでは有効になっていません。私はあなたがより良く理解

  1. https://www.ibm.com/developerworks/community/blogs/aimsupport/entry/what_is_mqtt_and_how_does_it_work_with_websphere_mq?lang=en
  2. https://www.ibm.com/support/knowledgecenter/en/SS9D84_1.0.0/com.ibm.mm.tc.doc/tc00110_.htm
関連する問題