use of io.smallrye.reactive.messaging.providers.extension.MutinyEmitterImpl in project smallrye-reactive-messaging by smallrye.
the class MutinyEmitterInjectionTest 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 Strategy.BUFFER;
}
@Override
public long bufferSize() {
return 128;
}
};
EmitterConfiguration config = new EmitterConfiguration("my-channel", true, overflow, null);
MutinyEmitterImpl<String> emitter = new MutinyEmitterImpl<>(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