0.1.6 • Published 9 years ago
xen-service v0.1.6
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
TODOwrap dispatch in middleware, or override it completelyTODOexternal RPC helper for Docker Swarm mode service discoveryTODOtrace dispatches across multiple nested procedure calls
WIP Creating a Service
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'
});
})