Java Code Examples for org.eclipse.microprofile.reactive.streams.operators.PublisherBuilder#map()

The following examples show how to use org.eclipse.microprofile.reactive.streams.operators.PublisherBuilder#map() . 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: PublisherBuilderVerification.java    From microprofile-reactive-streams-operators with Apache License 2.0 5 votes vote down vote up
@Test
public void builderShouldBeImmutable() {
    PublisherBuilder<Integer> builder = builder();
    PublisherBuilder<Integer> mapped = builder.map(Function.identity());
    PublisherBuilder<Integer> distinct = builder.distinct();
    CompletionRunner<Void> cancelled = builder.cancel();
    getAddedStage(Stage.Map.class, graphFor(mapped));
    getAddedStage(Stage.Distinct.class, graphFor(distinct));
    getAddedStage(Stage.Cancel.class, graphFor(cancelled));
}
 
Example 2
Source File: StreamTransformerMediator.java    From smallrye-reactive-messaging with Apache License 2.0 5 votes vote down vote up
private void processMethodConsumingAPublisherBuilderOfPayload() {
    function = builder -> {
        PublisherBuilder<Object> unwrapped = builder
                .flatMapCompletionStage(managePreProcessingAck())
                .map(Message::getPayload);
        PublisherBuilder<Object> result = invoke(unwrapped);
        Objects.requireNonNull(result, msg.methodReturnedNull(configuration.methodAsString()));
        return result.map(o -> (Message<?>) Message.of(o));
    };
}
 
Example 3
Source File: AppendingDecorator.java    From smallrye-reactive-messaging with Apache License 2.0 4 votes vote down vote up
@Override
public PublisherBuilder<? extends Message<?>> decorate(PublisherBuilder<? extends Message<?>> publisher,
        String channelName) {
    return publisher.map((m) -> this.appendString(m, channelName));
}