forked from quarkusio/quarkus-quickstarts
-
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.
Migrate the context propagation quickstart to RESTEasy Reactive
- Loading branch information
1 parent
b13185c
commit 920ab3d
Showing
3 changed files
with
20 additions
and
13 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
19 changes: 13 additions & 6 deletions
19
context-propagation-quickstart/src/main/java/org/acme/context/PriceResource.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 |
---|---|---|
@@ -1,20 +1,27 @@ | ||
package org.acme.context; | ||
|
||
import io.smallrye.mutiny.Uni; | ||
import io.smallrye.reactive.messaging.MutinyEmitter; | ||
import org.eclipse.microprofile.reactive.messaging.Channel; | ||
import org.eclipse.microprofile.reactive.messaging.OnOverflow; | ||
|
||
import javax.inject.Inject; | ||
import javax.ws.rs.POST; | ||
import javax.ws.rs.Path; | ||
|
||
import org.eclipse.microprofile.reactive.messaging.Channel; | ||
import org.eclipse.microprofile.reactive.messaging.Emitter; | ||
|
||
@Path("/") | ||
public class PriceResource { | ||
|
||
@Inject @Channel("prices") Emitter<Double> emitter; | ||
@Inject @Channel("prices") | ||
MutinyEmitter<Double> emitter; | ||
|
||
@POST | ||
public void postAPrice(Price price) { | ||
emitter.send(price.value); | ||
public Uni<Void> postAPrice(Price price) { | ||
if (emitter.hasRequests()) { | ||
return emitter.send(price.value); | ||
} else { | ||
return Uni.createFrom().nullItem(); | ||
} | ||
} | ||
|
||
} |