sdk-java/formats/json-jackson
Francesco Guardiani 34408236db
Moved CloudEventUtils from impl to io.cloudevents.core (#261)
Renamed CloudEventUtils#toVisitable to CloudEventUtils#toReader
Added CloudEventUtils#toEvent

Signed-off-by: Francesco Guardiani <francescoguard@gmail.com>
2020-11-13 10:00:49 +01:00
..
src Moved CloudEventUtils from impl to io.cloudevents.core (#261) 2020-11-13 10:00:49 +01:00
README.md Bump to 2.0.0-milestone4 (#254) 2020-11-09 14:06:44 +01:00
pom.xml Bump to 2.0.0-SNAPSHOT (#255) 2020-11-09 14:13:56 +01:00

README.md

Json EventFormat implementation with Jackson

Javadocs

Implementation of EventFormat using Jackson.

For Maven:

<dependency>
    <groupId>io.cloudevents</groupId>
    <artifactId>cloudevents-json-jackson</artifactId>
    <version>2.0.0-milestone4</version>
</dependency>

Usage

You don't need to perform any operation to configure the module, more than adding the dependency to your project:

CloudEvent event = CloudEventBuilder.v1()
  .withId("hello")
  .withType("example.vertx")
  .withSource(URI.create("http://localhost"))
  .build();

byte[] serialized = EventFormatProvider
  .getInstance()
  .resolveFormat(JsonFormat.CONTENT_TYPE)
  .serialize(event);