io.smallrye.reactive.messaging.annotations.Broadcast Java Examples

The following examples show how to use io.smallrye.reactive.messaging.annotations.Broadcast. 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 vote down vote up
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: FruitsEventProcessor.java    From knative-tutorial with Apache License 2.0 5 votes vote down vote up
@Incoming("fruit-events")
@Outgoing("fruit-events-stream")
@Broadcast
public String processFruitEvent(String feJson ) {
    logger.info("SSE Data:" + feJson);
    return feJson;
}
 
Example #3
Source File: PriceConverter.java    From quarkus-quickstarts with Apache License 2.0 5 votes vote down vote up
@Incoming("prices")
@Outgoing("my-data-stream")
@Broadcast
public double process(byte[] priceRaw) {
    int priceInUsd = Integer.parseInt(new String(priceRaw));
    System.out.println("Receiving price: " + priceInUsd);
    return priceInUsd * CONVERSION_RATE;
}
 
Example #4
Source File: Receiver.java    From if1007 with MIT License 5 votes vote down vote up
@Incoming("names")
@Outgoing("names-stream")
@Broadcast
public String processMessage(String receivedName) {
    log.info(receivedName);
    return String.format(template, receivedName);
}
 
Example #5
Source File: BroadcastExamples.java    From smallrye-reactive-messaging with Apache License 2.0 4 votes vote down vote up
@Incoming("in")
@Outgoing("out")
@Broadcast
public int increment(int i) {
    return i + 1;
}
 
Example #6
Source File: BroadcastWithCountExamples.java    From smallrye-reactive-messaging with Apache License 2.0 4 votes vote down vote up
@Incoming("in")
@Outgoing("out")
@Broadcast(2)
public int increment(int i) {
    return i + 1;
}
 
Example #7
Source File: BeanUsingBroadcast.java    From smallrye-reactive-messaging with Apache License 2.0 4 votes vote down vote up
@Outgoing("Y")
@Incoming("X")
@Broadcast(2)
public String process(String s) {
    return s.toUpperCase();
}
 
Example #8
Source File: StreamSkipTest.java    From smallrye-reactive-messaging with Apache License 2.0 4 votes vote down vote up
@Outgoing("in")
@Broadcast(4)
public Multi<String> generate() {
    return Multi.createFrom().items(
            "a", "b", "c", "skip", "d", "skip", "e", "f", "skip", "g", "h", "i", "skip", "j");
}
 
Example #9
Source File: SingleSkipTest.java    From smallrye-reactive-messaging with Apache License 2.0 4 votes vote down vote up
@Outgoing("in")
@Broadcast(4)
public Multi<String> generate() {
    return Multi.createFrom().items(
            "a", "b", "c", "skip", "d", "skip", "e", "f", "skip", "g", "h", "i", "skip", "j");
}
 
Example #10
Source File: InvalidBindingTest.java    From smallrye-reactive-messaging with Apache License 2.0 4 votes vote down vote up
@Outgoing("source")
@Broadcast(2)
public Publisher<String> foo() {
    return ReactiveStreams.of("a", "b").via(UnicastProcessor.create()).buildRs();
}
 
Example #11
Source File: PriceConverter.java    From quarkus-quickstarts with Apache License 2.0 4 votes vote down vote up
@Incoming("prices")
@Outgoing("my-data-stream")
@Broadcast
public double process(int priceInUsd) {
    return priceInUsd * CONVERSION_RATE;
}
 
Example #12
Source File: PriceConverter.java    From quarkus-quickstarts with Apache License 2.0 4 votes vote down vote up
@Incoming("prices")
@Outgoing("my-data-stream")
@Broadcast
public double process(int priceInUsd) {
    return priceInUsd * CONVERSION_RATE;
}
 
Example #13
Source File: BroadcastLiteral.java    From quarkus with Apache License 2.0 4 votes vote down vote up
@Override
public Class<? extends Annotation> annotationType() {
    return Broadcast.class;
}
 
Example #14
Source File: ChannelEmitterWithOverflowAndBroadcast.java    From quarkus with Apache License 2.0 4 votes vote down vote up
@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;
}
 
Example #15
Source File: MyProcessor.java    From quarkus with Apache License 2.0 4 votes vote down vote up
@Incoming("input")
@Outgoing("processed")
@Broadcast
public String process(String input) {
    return input.toUpperCase();
}