0.0.7 • Published 8 years ago
seneca-service-area v0.0.7
#Why
Instead of dispatching directly to a service created by seneca().listen and this way be coupled to the existence of a microservice, you just dispatch to the seneca instance available in current service.
#Usage:
var seneca = require('seneca')
var configureDispatching = require('seneca-service-area').configureDispatching
const senecaInstance =
seneca()
.use(configureDispatching, {
user: {
port: 8082,
host: 'localhost',
protocol: 'http'
},
email: {
port: 8081,
host: 'localhost',
protocol: 'http'
}
})
#What it does
This configures a senecaInstance object to dispatch any commands that match the pattern {area: 'user'}, {area: 'email'} to:
seneca().listen({
port: 8081,
host: 'localhost',
protocol: 'http'
})
It pretty much does the following:
var userService = seneca().listen({
port: 8081,
host: 'localhost',
protocol: 'http'
})
providedSenecaInstance.add({area:'user'}, (msg, done) => userService.act(msg, done))