Hey,
One of the main points of having an EventSourced persistence mechanism
is so that several clients can access the list of events that have been
done through a UnitOfWork. I'd like to create a REST resource for this,
and I believe this has been discussed before even.
My suggestion:
create an Atom feed mounted on (e.g.):
/events
When accessed this generates an Atom feed where each entry is a single
UnitOfWork, which then consists of a number of events:
<feed>
<entry>
<id>cca5ee27-765a-47ee-a030-5d2303a4ca6b-0</id>
<content type="text">{entry content}</content>
</entry>
<entry>
<id>cca5ee27-765a-47ee-a030-5d2303a4ca6b-1</id>
<content type="text">{entry content}</content>
</entry>
<entry>
<id>cca5ee27-765a-47ee-a030-5d2303a4ca6b-2</id>
<content type="text">{entry content}</content>
</entry>
</feed>
The "id" is that of the unitOfWork. This feed can then be parsed by
clients which can perform operations based on it, such as updating
read-stores, indexes for searching, auditing, store the feed for
backups, etc.
Going to /events will get the latest list of changes, up to say 10
UoW's. To get older changes one would have to do:
/events?start={some older id}
This link is constructed by the server and is included in the <feed> as
a "previous" link (<link rel="previous" href="events?start={id}"). These
links can be followed by the client until the first set of events is
reached.
There are more issues to be discussed, such as the format of the content
(JSON or XML basically), but does the above seem to be on the right track?
/Rickard
_______________________________________________
qi4j-dev mailing list
[email protected]
http://lists.ops4j.org/mailman/listinfo/qi4j-dev