cloudevents / cloudevents/sdk-java
Extension of Quarkus example with structured content mode
@matejvasek is already working on this.
Since Jul 19, 2022.
- Dominant language
- Java
- Stars
- 446
- Forks
- 172
- PR merge metrics
- No merged PRs in 30d
Description
I like the Quarkus example.
However, it seems to use the Binary Content Mode. I however require the Structured Content Mode. Initially I did not even notice that the binary mode left out the metadata from the body. I did not even notice initially there were 2 modes.
It took me quite some time that all that's required is adding the annotation @Consumes( JsonFormat.CONTENT_TYPE ) to the client:
@Path( "/notify" )
@RegisterRestClient
public interface BrokerClient {
@POST
@Consumes( JsonFormat.CONTENT_TYPE )
void emit( CloudEvent event);
}
Will trigger sending the request in the Structured Content Mode.
Likewise adding a @Consumes( JsonFormat.CONTENT_TYPE ) to the server:
@POST
@Path( "notify" )
@Consumes( JsonFormat.CONTENT_TYPE )
public Response create( CloudEvent event ) {
// logic
}
Fixes the server part. All the more confusing is that this reference mentions the Quarkus example (while discussing the structured content mode).
Suggestion: update the README.md or extend the example.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.