def pod_cmd(): parser = get_parser("pod") (options, args) = parser.parse_args(sys.argv[2:]) pods = pod.load_pod_dir(dirname=options.directory, timeout=options.timeout, filter_fn=pod.get_pod_filter(options.pod)) pods.update(pod.get_barker_metadata()) json.dump(pods, sys.stdout, sort_keys=True, indent=4) return 0
def publish_cmd(): parser = get_parser("publish") (options, args) = parser.parse_args(sys.argv[2:]) if len(args) < 1: parser.error("You must provide a queue hostname to publish to!") exchange = Exchange(options.exchange, type="fanout", delivery_mode="transient") queue = Queue(options.queue, exchange) connection = BrokerConnection(hostname=args[0], userid=options.userid, password=options.password, virtual_host=options.vhost) channel = connection.channel() producer = Producer(channel, exchange) pods = pod.load_pod_dir(dirname=options.directory, timeout=options.timeout, # The first arg is the queue hostname, the rest # will be pod names filter_fn=pod.get_pod_filter(options.pod)) pods.update(pod.get_barker_metadata()) producer.publish(pods, serializer="json") return 0
def publish_cmd(): parser = get_parser("publish") (options, args) = parser.parse_args(sys.argv[2:]) if len(args) < 1: parser.error("You must provide a queue hostname to publish to!") exchange = Exchange(options.exchange, type="fanout", delivery_mode="transient") queue = Queue(options.queue, exchange) connection = BrokerConnection(hostname=args[0], userid=options.userid, password=options.password, virtual_host=options.vhost) channel = connection.channel() producer = Producer(channel, exchange) pods = pod.load_pod_dir( dirname=options.directory, timeout=options.timeout, # The first arg is the queue hostname, the rest # will be pod names filter_fn=pod.get_pod_filter(options.pod)) pods.update(pod.get_barker_metadata()) producer.publish(pods, serializer="json") return 0