0
我是IBM MQ的新手用戶。基本上我想建立客戶端(Eclipse Paho)和IBM MQ隊列管理器之間的連接。Eclipse Paho和IBM Websphere MQ之間沒有建立連接MQ
我已執行以下步驟:
- 我已經安裝了IBM MQ v.9.0
- 創建隊列管理器
- 發起者一個隊列管理器與端口號服務(1414)
- 創建服務器通道並將其與創建的隊列管理器一起分配。
在客戶端:
- Downloadd Eclipse的泛美衛生組織,這是MQTT Java客戶端。
- 嘗試用小程序連接啓動的隊列管理器。
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
有沒有人能告訴我什麼可能是錯的?或任何建議。
做了qmgrs/QMGRNAME目錄錯誤在你檢查AMQERR01.LOG?你確定聽衆正在運行嗎?你定義了什麼渠道類型? – JoshMc