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 abyte[]
as data but rather aCloudEventData
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 theCloudEventData
returned bycloudEvent.getData()
is instance ofDocumentCloudEventData
and if so extract the underlyingorg.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-inJsonCloudEventData
class from thecloudevents-json-jackson
module, or use theDocumentCloudEventData
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.