-
Notifications
You must be signed in to change notification settings - Fork 178
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2342 from ozangunalp/publisher_decorator_emitter
Decorate emitters with PublisherDecorators
- Loading branch information
Showing
7 changed files
with
204 additions
and
17 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
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
25 changes: 25 additions & 0 deletions
25
...essaging-provider/src/test/java/io/smallrye/reactive/messaging/decorator/EmitterBean.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,25 @@ | ||
package io.smallrye.reactive.messaging.decorator; | ||
|
||
import java.util.Arrays; | ||
import java.util.List; | ||
|
||
import jakarta.inject.Inject; | ||
|
||
import org.eclipse.microprofile.reactive.messaging.Channel; | ||
import org.eclipse.microprofile.reactive.messaging.Emitter; | ||
|
||
public class EmitterBean { | ||
|
||
public static final List<String> TEST_STRINGS = Arrays.asList("foo", "bar", "baz"); | ||
|
||
@Inject | ||
@Channel("sink") | ||
Emitter<String> emitter; | ||
|
||
public void sendStrings() { | ||
for (String msg : TEST_STRINGS) { | ||
emitter.send(msg); | ||
} | ||
} | ||
|
||
} |
37 changes: 37 additions & 0 deletions
37
...rc/test/java/io/smallrye/reactive/messaging/providers/metrics/EmitterMetricsTestBean.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,37 @@ | ||
package io.smallrye.reactive.messaging.providers.metrics; | ||
|
||
import java.util.Arrays; | ||
import java.util.List; | ||
|
||
import jakarta.enterprise.context.ApplicationScoped; | ||
import jakarta.inject.Inject; | ||
|
||
import org.eclipse.microprofile.reactive.messaging.Channel; | ||
import org.eclipse.microprofile.reactive.messaging.Emitter; | ||
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; | ||
|
||
@ApplicationScoped | ||
public class EmitterMetricsTestBean { | ||
|
||
public static final List<String> TEST_MESSAGES = Arrays.asList("foo", "bar", "baz"); | ||
|
||
@Inject | ||
@Channel("source") | ||
Emitter<String> emitter; | ||
|
||
public void sendMessages() { | ||
for (String msg : TEST_MESSAGES) { | ||
emitter.send(msg); | ||
} | ||
} | ||
|
||
@Incoming("source") | ||
@Outgoing("sink") | ||
public PublisherBuilder<String> duplicate(String input) { | ||
return ReactiveStreams.of(input, input); | ||
} | ||
|
||
} |
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