def _make_publisher(self):
bus_url = 'amqp://{username}:{password}@{host}:{port}//'.format(**self.config)
bus_connection = Connection(bus_url)
same_exchange_arguments_as_collectd = {'arguments': {'auto_delete': True}, 'durable': False}
bus_exchange = Exchange(self.config['exchange_name'],
type=self.config['exchange_type'],
**same_exchange_arguments_as_collectd)
bus_producer = Producer(bus_connection, exchange=bus_exchange, auto_declare=True)
bus_marshaler = CollectdMarshaler(self._uuid)
return Publisher(bus_producer, bus_marshaler)
评论列表
文章目录