Hello,
Thanks all of you for dedication on amazing vert.x framework. !!
I'm trying to apply vertex-rabbitmq-client ( http://vertx.io/docs/vertx-rabbitmq-client/java/ ) to our vert.x tcp server.
I got a error message as follow when I try to connect to rabbitMQ server.
io.vertx.core.impl.NoStackTraceThrowable: Not connected
Did I miss something?
I confirmed python program can connect successfully.
Here is the java source to test.
==================publisher=====================
JsonObject config = new JsonObject();
// Each parameter is optional
// The default parameter with be used if the parameter is not set
config.put("user", "client");
config.put("password", "client");
config.put("host", "147.6.130.123”);
config.put("port", 5672);
config.put("virtualHost", "dataService");
config.put("connectionTimeout", 60); // in seconds
config.put("requestedHeartbeat", 60); // in seconds
config.put("handshakeTimeout", 60); // in seconds
config.put("requestedChannelMax", 5);
config.put("networkRecoveryInterval", 5); // in seconds
config.put("automaticRecoveryEnabled", true);
client = RabbitMQClient.create(vertx, config);
final Async async = context.async();
JsonObject message = new JsonObject().put("body", "Hello RabbitMQ, from Vert.x !");
client.basicPublish("ttlExchange", "", message, pubResult -> {
if (pubResult.succeeded()) {
System.out.println("Message published !");
async.complete();
} else {
System.out.println("adsdsfsdfasdfa");
pubResult.cause().printStackTrace();
}
});
--
You received this message because you are subscribed to the Google Groups "vert.x" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vertx+un...@googlegroups.com.
Visit this group at https://groups.google.com/group/vertx.
To view this discussion on the web, visit https://groups.google.com/d/msgid/vertx/9ab324d0-956f-4f06-bf0e-761761400281%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
client.start(v->{
System.out.println("Started QQWERTYUI");
client.basicConsumer(main_queue_name, rabbitMQConsumerAsyncResult -> {
if (rabbitMQConsumerAsyncResult.succeeded()) {
System.out.println("RabbitMQ consumer created !");
RabbitMQConsumer mqConsumer = rabbitMQConsumerAsyncResult.result();
mqConsumer.handler(message -> {
System.out.println("Got message: " + message.body().toString());
});
} else {
System.out.println("Error connecing...............");
rabbitMQConsumerAsyncResult.cause().printStackTrace();
}
});
});