use of io.smallrye.reactive.messaging.providers.extension.EmitterImpl in project smallrye-reactive-messaging by smallrye.
the class EmitterInjectionTest method testWeCanHaveSeveralSubscribers.
// Reproduce #511
@Test
public void testWeCanHaveSeveralSubscribers() {
OnOverflow overflow = new OnOverflow() {
@Override
public Class<? extends Annotation> annotationType() {
return OnOverflow.class;
}
@Override
public Strategy value() {
return OnOverflow.Strategy.BUFFER;
}
@Override
public long bufferSize() {
return 128;
}
};
EmitterConfiguration config = new EmitterConfiguration("my-channel", false, overflow, null);
EmitterImpl<String> emitter = new EmitterImpl<>(config, 128);
Publisher<Message<? extends String>> publisher = emitter.getPublisher();
TestSubscriber<Message<? extends String>> sub1 = new TestSubscriber<>();
publisher.subscribe(sub1);
TestSubscriber<Message<? extends String>> sub2 = new TestSubscriber<>();
publisher.subscribe(sub2);
sub1.assertNoErrors();
sub2.assertNoErrors();
}
Aggregations