org.eclipse.microprofile.reactive.messaging.OnOverflow Java Examples
The following examples show how to use
org.eclipse.microprofile.reactive.messaging.OnOverflow.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: EmitterConfiguration.java From smallrye-reactive-messaging with Apache License 2.0 | 6 votes |
public EmitterConfiguration(String name, OnOverflow onOverflow, Broadcast broadcast) { this.name = name; if (onOverflow != null) { this.overflowBufferStrategy = onOverflow.value(); this.overflowBufferSize = onOverflow.bufferSize(); } else { this.overflowBufferStrategy = null; this.overflowBufferSize = -1; } if (broadcast != null) { this.broadcast = Boolean.TRUE; this.numberOfSubscriberBeforeConnecting = broadcast.value(); } else { this.broadcast = Boolean.FALSE; this.numberOfSubscriberBeforeConnecting = -1; } }
Example #2
Source File: EmitterImpl.java From smallrye-reactive-messaging with Apache License 2.0 | 5 votes |
Multi<Message<? extends T>> getPublisherForStrategy(OnOverflow.Strategy overFlowStrategy, long bufferSize, long defaultBufferSize, Consumer<MultiEmitter<? super Message<? extends T>>> deferred) { switch (overFlowStrategy) { case BUFFER: if (bufferSize > 0) { return ThrowingEmitter.create(deferred, bufferSize); } else { return ThrowingEmitter.create(deferred, defaultBufferSize); } case UNBOUNDED_BUFFER: return Multi.createFrom().emitter(deferred, BackPressureStrategy.BUFFER); case THROW_EXCEPTION: return ThrowingEmitter.create(deferred, 0); case DROP: return Multi.createFrom().emitter(deferred, BackPressureStrategy.DROP); case FAIL: return Multi.createFrom().emitter(deferred, BackPressureStrategy.ERROR); case LATEST: return Multi.createFrom().emitter(deferred, BackPressureStrategy.LATEST); case NONE: return Multi.createFrom().emitter(deferred, BackPressureStrategy.IGNORE); default: throw ex.illegalArgumentForBackPressure(overFlowStrategy); } }
Example #3
Source File: ProviderExceptions.java From smallrye-reactive-messaging with Apache License 2.0 | 4 votes |
@Message(id = 22, value = "Invalid back-pressure strategy: %s") IllegalArgumentException illegalArgumentForBackPressure(OnOverflow.Strategy overFlowStrategy);
Example #4
Source File: OnOverflowLiteral.java From quarkus with Apache License 2.0 | 4 votes |
public static OnOverflow create(String strategy, long buffer) { return new OnOverflowLiteral(strategy, buffer); }
Example #5
Source File: OnOverflowLiteral.java From quarkus with Apache License 2.0 | 4 votes |
@Override public Class<? extends Annotation> annotationType() { return OnOverflow.class; }
Example #6
Source File: ChannelEmitterWithOverflow.java From quarkus with Apache License 2.0 | 4 votes |
@Inject public void setEmitter(@Channel("sink-1") Emitter<String> sink1, @Channel("sink-2") @OnOverflow(value = OnOverflow.Strategy.BUFFER, bufferSize = 4) Emitter<String> sink2) { this.emitterForSink1 = sink1; this.emitterForSink2 = sink2; }
Example #7
Source File: ChannelEmitterWithOverflowAndBroadcast.java From quarkus with Apache License 2.0 | 4 votes |
@Inject public void setEmitter(@Channel("sink-1") @Broadcast Emitter<String> sink1, @Channel("sink-2") @Broadcast @OnOverflow(value = OnOverflow.Strategy.BUFFER, bufferSize = 4) Emitter<String> sink2) { this.emitterForSink1 = sink1; this.emitterForSink2 = sink2; }