2019-08-15 14:05:30 -07:00
|
|
|
import Base from '@uci/base'
|
|
|
|
|
2019-12-23 14:15:50 -08:00
|
|
|
const PORT = process.env.PORT || 9000
|
|
|
|
|
|
|
|
let processor = new Base({sockets:'inter#s>t', inter:{port:PORT}, id:'interrupt-processor', useRootNS:true})
|
2019-08-15 14:05:30 -07:00
|
|
|
|
|
|
|
processor.interrupt = async function (packet) {
|
|
|
|
return new Promise((resolve) => {
|
|
|
|
console.log('interrupt occured')
|
|
|
|
console.dir(packet)
|
|
|
|
resolve({status: 'processed'})
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
processor.reply = async function (packet) {
|
|
|
|
return new Promise((resolve) => {
|
|
|
|
|
|
|
|
console.log('reply from interrupt with packet')
|
|
|
|
console.dir(packet)
|
|
|
|
resolve({status: 'processed'})
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
;
|
|
|
|
(async () => {
|
|
|
|
|
|
|
|
await processor.init()
|
2019-12-23 14:15:50 -08:00
|
|
|
|
2019-08-15 14:05:30 -07:00
|
|
|
|
|
|
|
})().catch(err => {
|
|
|
|
console.error('FATAL: UNABLE TO START SYSTEM!\n',err)
|
|
|
|
})
|