HTTP Handling For JSON Event Sourcing

January 9, 2026 ยท View on GitHub

The JSON Event Sourcing solution works with Kafka and MongoDB. The library in this package provides the HTTP handling for that environment. You can use it to easily enable that logic in a Java HTTP server solution. An example is the pincette-jes-http repository, which uses a Netty HTTP server and delegates everything to this library.

The URL path for an aggregate always has the form [/context][/application]/aggregate_type[/id]. When the identifier is set, one specific aggregate instance is addressed. Without it the complete collection of aggregates of that type is addressed. For example, a POST would do a search on all the aggregate instances.

Requests need to have a valid JSON Web Token. They are taken from the bearer token in the Authorization header. If none is found, the username will be "anonymous". Signatures of JWTs are not validated here.

Methods

PathMethodDescription
[/app]/type/idGETFetches an aggregate instance.
POSTSends a command to an aggregate instance.
PUTReplaces an aggregate instance.
[/app]/typePOSTPerforms a search in a collection of aggregates of some type. The request body should be either a JSON array containing MongoDB aggregation pipeline stages or a JSON object with the fields aggregate and/or options. The former should then have the array of stages. If the aggregate never uses the _acl field, then you can add the optional URL-parameter noacl=true to simplify the query. Otherwise the full ACL expression will be added to the incoming query.

Aggregation Options

The search can have an options object. The supported fields are allowDiskUse, batchSize, bypassDocumentValidation, collation (with all of its subfields), comment, hint (index name), let, maxAwaitTimeMS and maxTimeMS.