forked from vert-x3/vertx-examples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathReceiver.java
24 lines (20 loc) · 801 Bytes
/
Receiver.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package io.vertx.example.stomp.client;
import io.vertx.core.Future;
import io.vertx.core.VerticleBase;
import io.vertx.ext.stomp.StompClient;
import io.vertx.ext.stomp.StompClientOptions;
import io.vertx.launcher.application.VertxApplication;
public class Receiver extends VerticleBase {
public static void main(String[] args) {
VertxApplication.main(new String[]{Receiver.class.getName()});
}
@Override
public Future<?> start() throws Exception {
return StompClient.create(vertx, new StompClientOptions().setLogin("artemis").setPasscode("artemis"))
.connect(61613, "localhost")
.onSuccess(connection -> {
connection.subscribe("/queue", frame ->
System.out.println("Just received a message from /queue : " + frame.getBodyAsString()));
});
}
}