valdasraps / esj

Java client for EventStore (http://geteventstore.com)
GNU Lesser General Public License v3.0
20 stars 5 forks source link

esj

Java client for EventStore (http://geteventstore.com)

Build Status Maven Central LGPLv3 License Java Development Kit 1.7

Project website

About

Event Store Java client. Designed to help Java programs easily communicate with Event Store database.

Functionality

Java client functionality:

Code example

Append to stream example:


import lt.emasina.esj.EventStore;
import lt.emasina.esj.model.Message;
...
EventStore es = new EventStore(InetAddress.getByName(HOSTNAME), PORTNUMBER);
...
es.appendToStream(STREAM_NAME, new ResponseReceiver() {
    @Override
    public void onResponseReturn(Message msg) {
        // do something
    },
    @Override
    public void onErrorReturn(Exception ex){
        // do something
    }
},EVENT);
...
es.close();

or in Java 7 manner:


import lt.emasina.esj.EventStore;
import lt.emasina.esj.model.Message;
...
try (EventStore es = new EventStore(InetAddress.getByName(HOSTNAME), PORTNUMBER)) {
    ...
    es.appendToStream(STREAM_NAME, new ResponseReceiver() {
    @Override
    public void onResponseReturn(Message msg) {
        // do something
    },
    @Override
    public void onErrorReturn(Exception ex){
        // do something
    }
    },EVENT);
    ...
}