Occurrent 0.3.0 is now available. The cloud event to MongoDB document mapping has been completely rewritten. This means that event stores and subscriptions no longer requires Jackson or the cloudevents-json-jackson module. This is possible thanks to the changes in io.cloudevents:cloudevents-api:2.0.0-milestone4. It’s also possible to store other types of contents besides JSON (such as text/xml or binary data) in the CloudEvent data in the events.
Big thanks to Francesco Guardiani for the initial pull request. Here are all changes:

  • Upgraded Java Mongo driver from 4.0.4 to 4.1.1
  • Upgraded to cloud events 2.0.0-milestone4. This introduces a breaking change since the CloudEvent SDK no longer returns a byte[] as data but rather a CloudEventData interface. You need to change your code from:

    byte[] data = cloudEvent.getData();
    

    to

    byte[] data = cloudEvent.getData().toBytes();
    
  • Fixed so that not only JSON data can be used as cloud event data. Now the content-type of the event is taken into consideration, and you can store any kind of data.
  • Introduced org.occurrent.eventstore.mongodb.cloudevent.DocumentCloudEventData, cloud event data will be represented in this format with loading events from an event store. This means that you could check if the CloudEventData returned by cloudEvent.getData() is instance of DocumentCloudEventData and if so extract the underlying org.bson.Document that represent the data in the database.
  • Occurrent no longer needs to perform double encoding of the cloud event data if content type is json. Instead of serializing the content manually to a byte[] you can use either the built-in JsonCloudEventData class from the cloudevents-json-jackson module, or use the DocumentCloudEventData provided by Occurrent to avoid this. See documentation here for more details.
  • Upgrading to spring-data-mongodb 3.1.1
  • Upgrading to reactor 3.4.0
  • The MongoDB event stores no longer needs to depend on the cloudevents-json-jackson module since Occurrent now ships with a custom event reader/writer.
  • The MongoDB event subscriptions no longer needs to depend on the cloudevents-json-jackson module since Occurrent now ships with a custom event reader/writer.