cloudevents / cloudevents/sdk-java

Extension of Quarkus example with structured content mode

Open
#465 17 comments 0 reactions 1 assignee View on GitHub

@matejvasek is already working on this.

Since Jul 19, 2022.

documentation enhancement
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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.