Change the publisher to take messages via a pull interface

This commit is contained in:
Thomas S Hatch 2011-05-06 21:50:31 -06:00
parent 2e50394d2a
commit d49b30e627
2 changed files with 7 additions and 9 deletions

View File

@ -64,7 +64,7 @@ def master_config(path):
'''
opts = {'interface': '0.0.0.0',
'publish_port': '4505',
'publish_rep_port': '45055',
'publish_pull_port': '45055',
'worker_threads': 5,
'worker_start_port': '45056',
'ret_port': '4506',

View File

@ -71,17 +71,16 @@ class Publisher(multiprocessing.Process):
'''
context = zmq.Context(1)
pub_sock = context.socket(zmq.PUB)
rep_sock = context.socket(zmq.REP)
pull_sock = context.socket(zmq.PULL)
pub_uri = 'tcp://' + self.opts['interface'] + ':'\
+ self.opts['publish_port']
rep_uri = 'tcp://127.0.0.1:' + self.opts['publish_rep_port']
pull_uri = 'tcp://127.0.0.1:' + self.opts['publish_pull_port']
self.opts['logger'].info('Starting the Salt Publisher on ' + pub_uri)
pub_sock.bind(pub_uri)
rep_sock.bind(rep_uri)
pull_sock.bind(pull_uri)
while True:
package = rep_sock.recv()
rep_sock.send('')
package = pull_sock.recv()
self.opts['logger'].info('Publishing command')
pub_sock.send(package)
@ -401,10 +400,9 @@ class MWorker(multiprocessing.Process):
load['tgt_type'] = clear_load['tgt_type']
payload['load'] = self.crypticle.dumps(load)
context = zmq.Context(1)
pub_sock = context.socket(zmq.REQ)
pub_sock.connect('tcp://127.0.0.1:' + self.opts['publish_rep_port'])
pub_sock = context.socket(zmq.PUSH)
pub_sock.connect('tcp://127.0.0.1:' + self.opts['publish_pull_port'])
pub_sock.send(salt.payload.package(payload))
pub_sock.recv()
return {'enc': 'clear',
'load': {'jid': jid}}