server_config['password'], server_config['host'], server_config['amqp-port'], server_config['vhost'])) logger.info(url) params = pika.URLParameters(url) params.socket_timeout = 5 # Connect to CloudAMQP connection = pika.BlockingConnection(params) # start a channel channel = connection.channel() rabbitmq_api_utils = rabbitmq_api_utils.RabbitmqAPIUtils( server_config['protocol'], server_config['host'], server_config['http-port'], server_config['user'], server_config['password']) queue_name = input("Please enter queue name: ") response = rabbitmq_api_utils.get_queue_by_name(server_config['vhost'], queue_name) if response.status_code is not 200: logger.error('Queue not found!') exit() queue = response.json() # Declare a queue channel.queue_declare(queue=queue['name'], durable=queue['durable'])
logger.info("Blue URL: {}".format(blue_url)) green_config = config_resolver.ConfigResolver(logger) green_server_config = green_config.load_server_config('green') green_url = os.environ.get( 'URL', 'amqp://{}:{}@{}:{}'.format(green_server_config['user'], green_server_config['password'], green_server_config['host'], green_server_config['amqp-port'])) logger.info("Green URL: {}".format(green_url)) blue_rmq_utils = rabbitmq_api_utils.RabbitmqAPIUtils( blue_server_config['protocol'], blue_server_config['host'], blue_server_config['http-port'], blue_server_config['user'], blue_server_config['password']) green_rmq_utils = rabbitmq_api_utils.RabbitmqAPIUtils( green_server_config['protocol'], green_server_config['host'], green_server_config['http-port'], green_server_config['user'], green_server_config['password']) blue_definitions_json = blue_rmq_utils.export_definitions().json() import_result = green_rmq_utils.import_definitions(blue_definitions_json) logger.info("Import definitions from blue to green: {}".format(import_result)) all_queues_blue = blue_rmq_utils.get_all_queues() queues_to_federate = list(