README
Xen Service
Simple and flexible microservice library. Features:
- declarative constructor syntax
- action/dispatch-based internal RPC (inspired by Flux)
- functional to the core
- build services with RxJS 5, Promises, or blocking code
TODO
wrap dispatch in middleware, or override it completelyTODO
external RPC helper for Docker Swarm mode service discoveryTODO
trace dispatches across multiple nested procedure calls
Creating a Service WIP
XenServer.createService
accepts a service config object and returns an Observable.
const XenService = require('xen-service');
// Configure your new service
XenService.createService({
name: 'MyService',
procedures: {
test: () => 'Prepare for unforeseen consequences'
}
})
// Create the service by subscribing to it
.subscribe(service => {
// Once the service is ready, invoke the "test" procedure by
// dispatching an action of the same type
service.dispatch({
type: 'test'
})
.subscribe(response => {
console.log(service); // 'Prepare for unforeseen consequences'
});
})