activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aragoubi <aymen....@gmail.com>
Subject Can't connect to broker from paho mqtt client
Date Thu, 11 May 2017 08:59:40 GMT
Hi,

I have an embedded activeMQ broker listening to two ports.
Here's my broker-config file : 

<?xml version="1.0" encoding="UTF-8"?>
<beans
  xmlns="http://www.springframework.org/schema/beans"
  xmlns:amq="http://activemq.apache.org/schema/core"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
  http://activemq.apache.org/schema/core
http://activemq.apache.org/schema/core/activemq-core.xsd">

  
  <broker xmlns="http://activemq.apache.org/schema/core" useJmx="true"
useShutdownHook="false"  brokerName="mimo.broker1">

     <managementContext>
       
       <managementContext createConnector="false"/>
     </managementContext>
	 
	 <systemUsage>
		<systemUsage>
			<memoryUsage>
				<memoryUsage limit="64 mb"/>
			</memoryUsage>
			<storeUsage>
				<storeUsage limit="100 gb"/>
			</storeUsage>
			<tempUsage>
				<tempUsage limit="50 gb"/>
			</tempUsage>
		</systemUsage>
	</systemUsage>

    <persistenceAdapter>
       <kahaDB directory="activemq-data/kahadb"/>
     </persistenceAdapter>

    <transportConnectors>
      <transportConnector name="mimo.broker1" uri="tcp://0.0.0.0:61616" />
	  <transportConnector name="mqtt+ws" uri="ws://0.0.0.0:1884"/>	  
    </transportConnectors>
    
  </broker>
</beans>

When I launch my jboss server I see that the broker is launched and
listening to ports:

11:00:33,792 INFO 
[org.apache.activemq.transport.TransportServerThreadSupport] (Starting
ActiveMQ Broker) Listening for connections at: tcp://DESKTOP-4D80FU1:61616
11:00:33,793 INFO  [org.apache.activemq.broker.TransportConnector] (Starting
ActiveMQ Broker) Connector mimo.broker1 started
11:00:33,849 INFO  [org.eclipse.jetty.server.Server] (Starting ActiveMQ
Broker) jetty-7.6.9.v20130131
11:00:33,876 INFO  [org.eclipse.jetty.server.handler.ContextHandler]
(Starting ActiveMQ Broker) started o.e.j.s.ServletContextHandler{/,null}
11:00:33,905 INFO  [org.eclipse.jetty.server.AbstractConnector] (Starting
ActiveMQ Broker) Started SelectChannelConnector@0.0.0.0:1884
11:00:33,906 INFO  [org.apache.activemq.transport.ws.WSTransportServer]
(Starting ActiveMQ Broker) Listening for connections at
ws://DESKTOP-4D80FU1:1884
11:00:33,907 INFO  [org.apache.activemq.broker.TransportConnector] (Starting
ActiveMQ Broker) Connector mqtt+ws started
11:00:33,908 INFO  [org.apache.activemq.broker.BrokerService] (Starting
ActiveMQ Broker) Apache ActiveMQ 5.9.0 (mimo.broker1,
ID:DESKTOP-4D80FU1-57645-1494493233653-0:1) started
11:00:33,909 INFO  [org.apache.activemq.broker.BrokerService] (Starting
ActiveMQ Broker) For help or more information please see:
http://activemq.apache.org

I tried a mqtt client using java paho mqttv3, this is how I tried to connect
to my broker: 

        String broker = "ws://127.0.0.1:1883"; 
        String clientId = "JavaSample"; 
        MemoryPersistence persistence = new MemoryPersistence(); 
        try { 
                 MqttAsyncClient sampleClient = new MqttAsyncClient(broker,
clientId, persistence); 
                 MqttConnectOptions connOpts = new MqttConnectOptions(); 
                 connOpts.setCleanSession(true); 
                 connOpts.setAutomaticReconnect(true); 
                 IMqttToken token = sampleClient.connect(connOpts); 
       }catch(MqttException e){ 
                  e.printStackTrace(); 
                } 

My problem is that the connection is never getting established with the
broker.
Either I am getting this error
"[org.apache.activemq.broker.TransportConnection.Transport]
(qtp749972657-157) Transport Connection to: MQTTSocket_2052272783 failed:
java.io.IOException: Invalid CONNECT encoding".

Anyone know how to resolve this problem? Is this an activeMQ configuration
problem?




--
View this message in context: http://activemq.2283324.n4.nabble.com/Can-t-connect-to-broker-from-paho-mqtt-client-tp4725948.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Mime
View raw message