-
-
Save devalexandre/8e402c603c06cf5da79d207d0c6791d2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const seneca = require('seneca')(); | |
seneca | |
.use('seneca-redis-transport') | |
.add({ | |
role:"math", | |
cmd:"calcAge" | |
},(msg,reply)=>{ | |
const oldYear = msg.year || 0 | |
const currentYear = new Date().getFullYear() | |
const age = currentYear - oldYear | |
seneca.client({ | |
type:"redis", | |
topic: "notify" | |
}).act({role:"notify",cmd:"send",text:age}) | |
reply(null,{ | |
answer:age | |
}) | |
}) | |
.listen({ | |
type: "redis", | |
topic: "math", | |
host: 'localhost', | |
port: 6379 | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment