wso2 / product-ei

An open source, a high-performance hybrid integration platform that allows developers quick integration with any application, data, or system.
https://wso2.com/integration/
Apache License 2.0
374 stars 280 forks source link

Unable to Publish message on MQTT Topic in IBM Websphere MQ from WSO2 EI 6.3.0 #3398

Closed omerkhalid34 closed 1 month ago

omerkhalid34 commented 5 years ago

Description: I am using WSO2 EI 6.3.0 to publish a message on a topic via MQTT in IBM Websphere MQ v8.0.0.5. . I am following this [link]. (https://docs.wso2.com/display/EI640/Sample+272%3APublishing+and+Subscribing+using+WSO2+ESB%27s+MQ+Telemetry+Transport).
When I am calling this I am getting the following error. IT doesn't matter if I define the client id or not the error is the same. Error:

2019-03-22 12:39:58,350] [] ERROR - MqttSender Exception occurred at sending message
Invalid client ID (2)
        at org.eclipse.paho.client.mqttv3.internal.ExceptionHelper.createMqttException(ExceptionHelper.java:31)
        at org.eclipse.paho.client.mqttv3.internal.ClientState.notifyReceivedAck(ClientState.java:973)
        at org.eclipse.paho.client.mqttv3.internal.CommsReceiver.run(CommsReceiver.java:128)
        at java.lang.Thread.run(Thread.java:748)
[2019-03-22 12:39:58,355] [] ERROR - MqttSender Error while disconnecting the mqtt client
Client is disconnected (32101)
        at org.eclipse.paho.client.mqttv3.internal.ExceptionHelper.createMqttException(ExceptionHelper.java:31)
        at org.eclipse.paho.client.mqttv3.internal.ClientComms.disconnect(ClientComms.java:467)
        at org.eclipse.paho.client.mqttv3.MqttAsyncClient.disconnect(MqttAsyncClient.java:703)
        at org.eclipse.paho.client.mqttv3.MqttAsyncClient.disconnect(MqttAsyncClient.java:672)
        at org.eclipse.paho.client.mqttv3.MqttAsyncClient.disconnect(MqttAsyncClient.java:679)
        at org.eclipse.paho.client.mqttv3.MqttClient.disconnect(MqttClient.java:258)
        at org.apache.axis2.transport.mqtt.MqttSender.sendMessage(MqttSender.java:132)
        at org.apache.axis2.transport.base.AbstractTransportSender.invoke(AbstractTransportSender.java:112)
        at org.apache.axis2.engine.AxisEngine$TransportNonBlockingInvocationWorker.run(AxisEngine.java:626)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:748)
[2019-03-22 12:39:58,374] []  INFO - AxisEngine [MessageContext: logID=f612e1cbac90fbe39bbbe8c4295f02207affcd67c7ead122] Exception occurred at sending message
[2019-03-22 12:39:58,388] [] ERROR - AsyncCallback Exception occurred at sending message
org.apache.axis2.AxisFault: Exception occurred at

My Proxy Service Code:

<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
       name="TestMQTTTopicPublishing"
       startOnLoad="true"
       statistics="disable"
       trace="disable"
       transports="jms">
   <target>
      <inSequence>
         <log level="full"
              separator="===------MQTT Service Started. Message Received---===="/>
         <property action="remove" name="TRANSPORT_HEADERS" scope="axis2"/>
         <property name="FORCE_SC_ACCEPTED"
                   scope="axis2"
                   type="STRING"
                   value="true"/>
         <property name="OUT_ONLY" scope="default" type="STRING" value="true"/>
         <call>
            <endpoint>
               <address uri="mqtt:/TestMQTTTopicPublishing?mqtt.server.host.name=localhost&amp;mqtt.server.port=1883&amp;mqtt.topic.name=FLIGHTELEGRAM.TOPIC&amp;mqtt.subscription.qos=2&amp;mqtt.blocking.sender=true&amp;mqtt.client.id=esbtestsender&amp;mqtt.session.clean=true&amp;mqtt.message.retained=true"/>
            </endpoint>
         </call>
         <log separator="=======-----Message Successfully Sent To MQTT Topic----====="/>
      </inSequence>
   </target>
   <parameter name="transport.jms.Destination">FLIGHTTELEGRAMS.QUEUE</parameter>
   <parameter name="transport.jms.ContentType">
      <rules xmlns="">
         <jmsProperty>contentType</jmsProperty>
         <default>application/xml</default>
      </rules>
   </parameter>
   <description/>
</proxy>

Also find attached the configuration of the Telemetry Channel in the IBM Websphere MQ MQTTChannelPNG

Please let me know what can I do to further narrow down the error or solve the problem. Thanks. .

Suggested Labels:

6.3.0, Type/Bug, MQTT, IBMWebsphere MQ

Affected Product Version: WSO2 EI 6.3.0

OS, DB, other environment details and versions:
Windows 10.

Nirothipan commented 5 years ago

Hi @omerkhalid34 ,

As per IBM MQ document , the error is

REASON_CODE_INVALID_CLIENT_ID | 2 | The server has rejected the supplied client ID.

According to this troubleshoot guide from IBM, could you please

Check that the client identifier is no longer than 23 bytes, and contains only characters from the range: A-Z, a-z, 0-9, './_%

also please note that EI adds client ID post-fix to make it unique.

Thanks Nirothipan