mirror of
https://github.com/openstf/stf
synced 2025-10-04 02:09:32 +02:00
Make all zmq endpoints use srv records.
This commit is contained in:
parent
f0aae7d4e5
commit
e43ae34d4b
8 changed files with 118 additions and 32 deletions
|
@ -15,6 +15,7 @@ var wireutil = require('../../wire/util')
|
|||
var wirerouter = require('../../wire/router')
|
||||
var dbapi = require('../../db/api')
|
||||
var datautil = require('../../util/datautil')
|
||||
var srv = require('../../util/srv')
|
||||
var cookieSession = require('./middleware/cookie-session')
|
||||
var ip = require('./middleware/remote-ip')
|
||||
var auth = require('./middleware/auth')
|
||||
|
@ -30,16 +31,26 @@ module.exports = function(options) {
|
|||
|
||||
// Output
|
||||
var push = zmq.socket('push')
|
||||
options.endpoints.push.forEach(function(endpoint) {
|
||||
log.info('Sending output to %s', endpoint)
|
||||
push.connect(endpoint)
|
||||
Promise.map(options.endpoints.push, function(endpoint) {
|
||||
return srv.resolve(endpoint).then(function(records) {
|
||||
return srv.attempt(records, function(record) {
|
||||
log.info('Sending output to "%s"', record.url)
|
||||
push.connect(record.url)
|
||||
return Promise.resolve(true)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
// Input
|
||||
var sub = zmq.socket('sub')
|
||||
options.endpoints.sub.forEach(function(endpoint) {
|
||||
log.info('Receiving input from %s', endpoint)
|
||||
sub.connect(endpoint)
|
||||
Promise.map(options.endpoints.sub, function(endpoint) {
|
||||
return srv.resolve(endpoint).then(function(records) {
|
||||
return srv.attempt(records, function(record) {
|
||||
log.info('Receiving input from "%s"', record.url)
|
||||
sub.connect(record.url)
|
||||
return Promise.resolve(true)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
// Establish always-on channels
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue