forked from cloudevents/sdk-java
-
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.
[cloudevents#465] Upgrade Quarkus examples with binary and structured…
… events (cloudevents#515) Signed-off-by: ruromero <rromerom@redhat.com>
- Loading branch information
Showing
5 changed files
with
58 additions
and
10 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"specversion" : "1.0", | ||
"type" : "User", | ||
"source": "io.cloudevents.examples/user", | ||
"id": "536808d3-88be-4077-9d7a-a3f162705f78", | ||
"subject": "SUBJ-0001", | ||
"data" : { | ||
"username": "jsmith", | ||
"firstName": "John", | ||
"lastName": "Smith", | ||
"age": 37 | ||
} | ||
} |
14 changes: 9 additions & 5 deletions
14
...s/restful-ws-quarkus/src/main/java/io/cloudevents/examples/quarkus/client/UserClient.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,24 @@ | ||
package io.cloudevents.examples.quarkus.client; | ||
|
||
import javax.ws.rs.Consumes; | ||
import javax.ws.rs.POST; | ||
import javax.ws.rs.Path; | ||
import javax.ws.rs.Produces; | ||
import javax.ws.rs.core.MediaType; | ||
|
||
import io.cloudevents.CloudEvent; | ||
import io.cloudevents.jackson.JsonFormat; | ||
|
||
import org.eclipse.microprofile.rest.client.inject.RegisterRestClient; | ||
|
||
@Path("/users") | ||
@RegisterRestClient | ||
public interface UserClient { | ||
|
||
// This will emit binary encoded events. | ||
// To use structured JSON encoding use @Produces(JsonFormat.CONTENT_TYPE). | ||
// To use structured JSON encoding use @Consumes(JsonFormat.CONTENT_TYPE). | ||
@POST | ||
void emitBinary(CloudEvent event); | ||
|
||
@POST | ||
@Produces(MediaType.APPLICATION_JSON) | ||
void emit(CloudEvent event); | ||
@Consumes(JsonFormat.CONTENT_TYPE) | ||
void emitStructured(CloudEvent event); | ||
} |
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