Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Paho » Regarding Rabbitmq with Mqtt Client Connection Failure(JAVA paho client to connect Rabbitmq using tcp connection)
Regarding Rabbitmq with Mqtt Client Connection Failure [message #1748916] Wed, 30 November 2016 06:50
Hardik lotiya is currently offline Hardik lotiyaFriend
Messages: 1
Registered: November 2016
Junior Member
I am using RabbitMq 3.6.6 with paho MqttClient 3.1.1.0 version

am trying to connect on Demand Connection with RabbitMq Server using this client.

code look like

Quote:
public static void main(String[] args){

String broker = "tcp://localhost:1883";
String clientId = "JavaSample";
MemoryPersistence persistence = new MemoryPersistence();
try {int i =0;
while(true){
MqttClient sampleClient = new MqttClient(broker, clientId+i, persistence);
MqttConnectOptions connOpts = new MqttConnectOptions();
connOpts.setCleanSession(true);
System.out.println("Connecting to broker: "+broker);
sampleClient.connect(connOpts);
System.out.println("Connected "+i);
if(i%100 == 0){
System.gc ();
System.runFinalization ();
}
i++;
}
} catch(MqttException me) {
System.out.println("reason "+me.getReasonCode());
System.out.println("msg "+me.getMessage());
System.out.println("loc "+me.getLocalizedMessage());
System.out.println("cause "+me.getCause());
System.out.println("excep "+me);
me.printStackTrace();
}
}


here clientId is diff for each connection, I want to connection on Demand
for this I tries to decrease stack size in 'eclipse.ini' file
like
openFile
--launcher.appendVmargs
-vmargs
-Xmn64m
-Xms64m
-Xmx512m
-Xss512m


In RabbitMq some update configuration ln 'rabbitmq.config' file

{vm_memory_high_watermark, {absolute, "5000M"}}


update high watermark memory because when upto 3k connection this memory is near about full.
for this update rabbitmq.config file and reduce tcp sending buffer and receiving buffer so this issue resolved.

and also update free size like

{disk_free_limit, "2GB"}

I am getting Exception like...........

Exception in thread "main" java.lang.OutOfMemoryError: unable to create new native thread
at java.lang.Thread.start0(Native Method)
at java.lang.Thread.start(Thread.java:714)
at org.eclipse.paho.client.mqttv3.internal.ClientComms$ConnectBG.start(ClientComms.java:625)
at org.eclipse.paho.client.mqttv3.internal.ClientComms.connect(ClientComms.java:244)
at org.eclipse.paho.client.mqttv3.internal.ConnectActionListener.connect(ConnectActionListener.java:186)
at org.eclipse.paho.client.mqttv3.MqttAsyncClient.connect(MqttAsyncClient.java:592)
at org.eclipse.paho.client.mqttv3.MqttClient.connect(MqttClient.java:240)
at MQTTMaxConcurrentConnections.main(MQTTMaxConcurrentConnections.java:130)



Any Idea how to resolve and get up 50000 connection?

Previous Topic:JS client subscribes multiple topic
Next Topic:MQTTPacket C support for MQTT 3.1.1
Goto Forum:
  


Current Time: Mon Nov 12 18:08:43 GMT 2018

Powered by FUDForum. Page generated in 0.01737 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top