use of io.crossbar.autobahn.wamp.Client in project autobahn-java by crossbario.
the class ReflectionPOJORegisterSample method registerReflectionPOJO.
public static CompletableFuture<ExitInfo> registerReflectionPOJO(String wsAddress, String realm) {
Session wampSession = new Session();
wampSession.addOnJoinListener((session, details) -> {
final IPOJOService service = new IPOJOService() {
@Override
public Person getPerson() {
return new Person("john", "doe", "hr");
}
@Override
public List<Person> getPeople() {
List<Person> persons = new ArrayList<>();
for (int i = 0; i < 7; i++) {
persons.add(new Person("john", "doe", "hr"));
}
return persons;
}
};
List<CompletableFuture<Registration>> registrations = session.getReflectionServices().registerCallee(service);
for (CompletableFuture<Registration> registrationCompletableFuture : registrations) {
registrationCompletableFuture.whenComplete((registration, throwable) -> {
System.out.println(String.format("Registered procedure %s", registration.procedure));
});
}
});
Client wampClient = new Client(wampSession, wsAddress, realm);
return wampClient.connect();
}
Aggregations