SpringBoot 2 + Project Reactor + Atmosphere = Atmosph4rX.
Reactive Streams made easy!
Atmosph4rX is a complete rewrite of the Atmosphere Framework. All the functionalities are or will be ported to Atmosph4rX.
- Work in Progress. See ROADMAP for more details.
@ReactTo("/mySubscriber")
public final class MySubscriber implements AxSubscriber<String> {
@Topic("/message")
private SocketsGroupProcessor<String> processor;
@Override
public void onSubscribe(AxSubscription s) {
processor.subscribe(s.socket());
}
@Override
public void onNext(String next) {
// Push data to all {@link Subscriber}s.
// toProcessor return a FluxProcessor
processor.toProcessor().onNext(next);
}
@Override
public void onComplete() {
}
@Override
public void onError(Throwable throwable) {
}
}
@ReactTo("/foo")
public final class MyPoJo {
@Topic("/message")
private SocketsGroupProcessor<String> processor;
@Open
public void open() {
}
@Close
public void close() {
}
@Message
public void on(String message) {
processor.publish(next);
}
@Error
public void error() {
}
}
<dependency>
<groupId>org.atmosphere</groupId>
<artifactId>atmosph4rx</artifactId>
<version>4.0.0-SNAPSHOT</version>
</dependency>