NOTES: Sorcery is an open source distributed server for event sourcing, it performs the role of event store and pub sub queue using REST
https://github.com/nicholasjackson/sorcery/blob/master/_build/swagger_spec/index.html
For building Sorcery into a container we use consul and consul-template to supply the defaults.
CONSUL=consul:8500
The system is made up of a server and either one or more workers.
Server: The server is responsible for receiving requests and for registering subscribers, exposes a HTTP endpoint
Workers: The workers publish the events, to the subscribers
API: HEADERS: X-API-Key: asdfasdasdasd33434
/publish/{event-name}
{
"name": {
"firstname": "Nic",
"surname": "Jackson"
},
"roles": [
"Admin",
"Guest"
]
}
subscribe is used by a service to register its endpoint in order to receive events of a particular type
/subscribe/{event-name}
{
"server-id": "12345"
"callback": "http://myserver.com/path" // POST
"filter": {"data": "name.firstname=jack%"} # see filters
}
/unsubscribe/{event-name}/{server-id}
/unsubscribe/all/{server-id}
/events/list/{event-name}/{limit}/{page}/{event_name}/{filter}
/events/reply/single/{event_id}
/events/reply/multiple/{event_name}/{filter}/{limit}
{
"date_start": "2015-10-12",
"date-end": "2015-10-13", //optional
"data": "name.firstname=nic%&name&roles[any]=Admin"
}
attempts to match a value on an data object using dot notation e.g. given the below object
{
"name": {
"firstname": "Nic",
"surname": "Jackson"
},
"roles": [
"Admin",
"Guest"
]
}
name.firstname=nic% would match this event
= equality matcher
!= inequality matcher
> greater than (number)
< less than (number)
%wildcard
[first] = first index
[any] = match any index
[last] = last index
[2] = 3rd index
data[any]=(name.firstname=nic%)