Java Code Examples for org.eclipse.microprofile.reactive.streams.operators.ReactiveStreams#fromIterable()

The following examples show how to use org.eclipse.microprofile.reactive.streams.operators.ReactiveStreams#fromIterable() . 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: MetricsTestBean.java    From microprofile-reactive-messaging with Apache License 2.0 5 votes vote down vote up
@Incoming(CONNECTOR_PROCESS)
@Outgoing(CONNECTOR_OUT)
@Acknowledgment(Strategy.PRE_PROCESSING)
public PublisherBuilder<Message<String>> split(Message<String> a) {
    List<Message<String>> messages = new ArrayList<>();
    for (int i = 1; i <=2; i++) {
        messages.add(Message.of(a.getPayload() + "-" + i));
    }
    return ReactiveStreams.fromIterable(messages);
}
 
Example 2
Source File: MetricsTestBean.java    From microprofile-reactive-messaging with Apache License 2.0 5 votes vote down vote up
@Incoming(CHANNEL_APP_A)
@Outgoing(CHANNEL_APP_B)
public PublisherBuilder<String> split(String input) {
    List<String> messages = new ArrayList<>();
    for (int i = 1; i <=2; i++) {
        messages.add(input + "-" + i);
    }
    return ReactiveStreams.fromIterable(messages);
}
 
Example 3
Source File: StageTestBase.java    From smallrye-mutiny with Apache License 2.0 4 votes vote down vote up
PublisherBuilder<Integer> infiniteStream() {
    return ReactiveStreams.fromIterable(() -> {
        AtomicInteger value = new AtomicInteger();
        return IntStream.generate(value::incrementAndGet).boxed().iterator();
    });
}
 
Example 4
Source File: DefaultReactiveStreamsFactory.java    From microprofile-reactive-streams-operators with Apache License 2.0 4 votes vote down vote up
@Override
public <T> PublisherBuilder<T> fromIterable(Iterable<? extends T> ts) {
    return ReactiveStreams.fromIterable(ts);
}
 
Example 5
Source File: MetricsTestBean.java    From smallrye-reactive-messaging with Apache License 2.0 4 votes vote down vote up
@Outgoing("source")
public PublisherBuilder<String> source() {
    return ReactiveStreams.fromIterable(TEST_MESSAGES);
}
 
Example 6
Source File: MultiStageBean.java    From smallrye-reactive-messaging with Apache License 2.0 4 votes vote down vote up
@Outgoing("A")
public PublisherBuilder<String> produceTestStrings() {
    return ReactiveStreams.fromIterable(TEST_STRINGS);
}
 
Example 7
Source File: SimpleProducerBean.java    From smallrye-reactive-messaging with Apache License 2.0 4 votes vote down vote up
@Outgoing("sink")
public PublisherBuilder<String> createStrings() {
    return ReactiveStreams.fromIterable(TEST_STRINGS);
}
 
Example 8
Source File: Operators.java    From smallrye-reactive-streams-operators with Apache License 2.0 4 votes vote down vote up
public <T> void fromIterable(Iterable<T> iterable) {
    // tag::fromIterable[]
    PublisherBuilder<T> stream = ReactiveStreams.fromIterable(iterable);
    // If the iterable does not contain elements, the resulting stream is empty.
    // end::fromIterable[]
}
 
Example 9
Source File: StageTestBase.java    From smallrye-reactive-streams-operators with Apache License 2.0 4 votes vote down vote up
PublisherBuilder<Integer> infiniteStream() {
    return ReactiveStreams.fromIterable(() -> {
        AtomicInteger value = new AtomicInteger();
        return IntStream.generate(value::incrementAndGet).boxed().iterator();
    });
}
 
Example 10
Source File: StageTestBase.java    From smallrye-reactive-streams-operators with Apache License 2.0 4 votes vote down vote up
PublisherBuilder<Integer> infiniteStream() {
    return ReactiveStreams.fromIterable(() -> {
        AtomicInteger value = new AtomicInteger();
        return IntStream.generate(value::incrementAndGet).boxed().iterator();
    });
}