-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
6 additions
and
9 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -191,6 +191,7 @@ import javax.ws.rs.GET; | |
import javax.ws.rs.Path; | ||
import javax.ws.rs.Produces; | ||
import javax.ws.rs.core.MediaType; | ||
import org.jboss.resteasy.annotations.SseElementType; | ||
/** | ||
* A simple resource retrieving the in-memory "my-data-stream" and sending the items as server-sent events. | ||
|
@@ -201,23 +202,19 @@ public class PriceResource { | |
@Inject | ||
@Stream("my-data-stream") Publisher<Double> prices; // <1> | ||
@GET | ||
@Produces(MediaType.TEXT_PLAIN) | ||
public String hello() { | ||
return "hello"; | ||
} | ||
@GET | ||
@Path("/stream") | ||
@Produces(MediaType.SERVER_SENT_EVENTS) // <2> | ||
public Publisher<Double> stream() { // <3> | ||
@Produces(MediaType.SERVER_SENT_EVENTS) // <2> | ||
@SseElementType("text/plain") // <3> | ||
public Publisher<Double> stream() { // <4> | ||
return prices; | ||
} | ||
} | ||
---- | ||
<1> Injects the `my-data-stream` stream using the `@Stream` qualifier | ||
<2> Indicates that the content is sent using `Server Sent Events` | ||
<3> Returns the stream (_Reactive Stream_) | ||
<3> Indicates that the data contained within the server sent events, is of type `text/plain` | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
gsmet
Member
|
||
<4> Returns the stream (_Reactive Stream_) | ||
|
||
== Configuring the Kafka connector | ||
|
||
|
it's minor but there shouldn't be a comma here.