use of io.crossbar.autobahn.wamp.types.ExitInfo in project autobahn-java by crossbario.
the class Service method start.
public int start(String url, String realm) {
LOGGER.info(String.format("Called with url=%s, realm=%s", url, realm));
// finally, provide everything to a Client instance
Client client = new Client(mSession, url, realm, mExecutor);
CompletableFuture<ExitInfo> exitFuture = client.connect();
try {
ExitInfo exitInfo = exitFuture.get();
return exitInfo.code;
} catch (Exception e) {
LOGGER.severe(e.getMessage());
return 1;
}
}
use of io.crossbar.autobahn.wamp.types.ExitInfo in project autobahn-java by crossbario.
the class Client method connect.
public CompletableFuture<ExitInfo> connect(TransportOptions options) {
CompletableFuture<ExitInfo> exitFuture = new CompletableFuture<>();
mSession.addOnConnectListener((session) -> mSession.join(mRealm, mAuthenticators).thenAccept(details -> LOGGER.i(String.format("JOINED session=%s realm=%s", details.sessionID, details.realm))));
mSession.addOnDisconnectListener((session, wasClean) -> exitFuture.complete(new ExitInfo(wasClean)));
CompletableFuture.runAsync(() -> {
try {
mTransports.get(0).connect(mSession, options);
} catch (Exception e) {
throw new CompletionException(e);
}
}, getExecutor());
return exitFuture;
}
use of io.crossbar.autobahn.wamp.types.ExitInfo in project autobahn-java by crossbario.
the class CIService method start.
public int start(String url, String realm) {
LOGGER.i(String.format("Called with url=%s, realm=%s", url, realm));
// finally, provide everything to a Client instance
Client client = new Client(mSession, url, realm, mExecutor);
CompletableFuture<ExitInfo> exitFuture = client.connect();
try {
ExitInfo exitInfo = exitFuture.get();
return exitInfo.code;
} catch (Exception e) {
LOGGER.e(e.getMessage());
return 1;
}
}
Aggregations