forked from smallrye/smallrye-reactive-messaging
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Handle post-processing for payload consuming stream returning process…
…or methods Closes smallrye#2732 and smallrye#2733
- Loading branch information
1 parent
233e114
commit d69033a
Showing
7 changed files
with
153 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
...ProducingAPublisherBuilderOfPayloadsAndConsumingIndividualPayloadWithProcessingError.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package io.smallrye.reactive.messaging.beans; | ||
|
||
import jakarta.enterprise.context.ApplicationScoped; | ||
|
||
import org.eclipse.microprofile.reactive.messaging.Acknowledgment; | ||
import org.eclipse.microprofile.reactive.messaging.Incoming; | ||
import org.eclipse.microprofile.reactive.messaging.Outgoing; | ||
import org.eclipse.microprofile.reactive.streams.operators.PublisherBuilder; | ||
import org.eclipse.microprofile.reactive.streams.operators.ReactiveStreams; | ||
|
||
import io.reactivex.Flowable; | ||
|
||
@ApplicationScoped | ||
public class BeanProducingAPublisherBuilderOfPayloadsAndConsumingIndividualPayloadWithProcessingError { | ||
|
||
@Incoming("count") | ||
@Outgoing("sink") | ||
@Acknowledgment(Acknowledgment.Strategy.POST_PROCESSING) | ||
public PublisherBuilder<String> process(Integer payload) { | ||
if (payload > 5) { | ||
throw new IllegalArgumentException("boom"); | ||
} | ||
return ReactiveStreams.of(payload) | ||
.map(i -> i + 1) | ||
.flatMapRsPublisher(i -> Flowable.just(i, i)) | ||
.map(i -> Integer.toString(i)); | ||
} | ||
|
||
} |
30 changes: 30 additions & 0 deletions
30
...ns/BeanProducingAPublisherOfPayloadsAndConsumingIndividualPayloadWithProcessingError.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package io.smallrye.reactive.messaging.beans; | ||
|
||
import jakarta.enterprise.context.ApplicationScoped; | ||
|
||
import org.eclipse.microprofile.reactive.messaging.Acknowledgment; | ||
import org.eclipse.microprofile.reactive.messaging.Incoming; | ||
import org.eclipse.microprofile.reactive.messaging.Outgoing; | ||
import org.eclipse.microprofile.reactive.streams.operators.ReactiveStreams; | ||
import org.reactivestreams.Publisher; | ||
|
||
import io.reactivex.Flowable; | ||
|
||
@ApplicationScoped | ||
public class BeanProducingAPublisherOfPayloadsAndConsumingIndividualPayloadWithProcessingError { | ||
|
||
@Incoming("count") | ||
@Outgoing("sink") | ||
@Acknowledgment(Acknowledgment.Strategy.POST_PROCESSING) | ||
public Publisher<String> process(Integer payload) { | ||
if (payload % 2 == 0) { | ||
throw new IllegalArgumentException("boom"); | ||
} | ||
return ReactiveStreams.of(payload) | ||
.map(i -> i + 1) | ||
.flatMapRsPublisher(i -> Flowable.just(i, i)) | ||
.map(i -> Integer.toString(i)) | ||
.buildRs(); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters