this is my consumer :
public class MQTTBasicSubExample {
public static void main(final String[] args) throws Exception {
// Create a new MQTT connection to the broker. We are not setting the
client ID. The broker will pick one for us.
System.out.println("Connecting to Artemis using MQTT");
MQTT mqtt = new MQTT();
mqtt.setConnectAttemptsMax(2);
mqtt.setReconnectAttemptsMax(1);
mqtt.setClientId("Test");
mqtt.setUserName("Admin");
mqtt.setPassword("manage");
BlockingConnection connection = null;
try{
connection = mqtt.blockingConnection();
connection.connect();
System.out.println("Connected to Artemis");
// Subscribe to topics
Topic[] topics = {new Topic("digital/test/data", QoS.EXACTLY_ONCE)};
connection.subscribe(topics);
System.out.println("Subscribed to topics.");
File f = new File("./lock/continue.lck");
while( !f.exists())
{
Message message = connection.receive(5, TimeUnit.SECONDS);
if(message != null)
{
System.out.println("Received messages.");
System.out.println(new String(message.getPayload()));
message.ack();
}
}
}
catch(Exception e)
{
e.printStackTrace();
}
finally{
System.out.println("deconnection");
if(connection!=null) connection.disconnect();
}
}
}
--
View this message in context:
http://activemq.2283324.n4.nabble.com/How-does-Apache-Artemis-manage-heap-space-RAM-tp4723220p4723465.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.