omron — Consume Messages of the outbound.Job Queue

3.3 RabbitMQ Python Examples Consume Messages of the outbound.Job Queue The example below consumes messages of the outbound.Job queue. NOTE: Set no_ack =True for acknowledging or no_ack =False to not acknowledge the consumed messages in subscribe_queue_and_print method. import os import ssl import pika import logging logging.basicConfig(level=logging.INFO) def get_connection(host, username, password, cert_path):

cp = pika.ConnectionParameters( host=host, port=5671, ssl=True, credentials=pika.PlainCredentials(username, password), ssl_options=dict( ssl_version=ssl.PROTOCOL_TLSv1, ca_certs=cert_path, cert_reqs=ssl.CERT_OPTIONAL ) ) return pika.BlockingConnection(cp) def subscribe_queue_and_print(conn, outbound_queue, no_ack=True): # Set no_ack =False to not acknowledge the consumed messages ch = conn.channel() assert ch.is_open print(ch.basic_get(outbound_queue)) def print_body(ch, method, properties, body): print(" [x] %r" % body) ch.basic_consume(print_body, queue=outbound_queue, no_ack=no_ack) ch.start_consuming() if __name__ == '__main__':

import sys user = 'toolkitadmin' password = 'uzJny0tb3FyhteE9BCuQ' # Change password to the generated password. FMIP = '10.151.26.181' # Change to the Fleet Manager IP FMIP, user, password, os.path.join(os.path.expanduser("~"), "Desktop\\itk-1-tests\\cert.crt") # Change the path to the path used in your application. conn = get_connection( ) outbound_queue = 'outbound.Job' # Change the queue to the desired outbound queue. subscribe_queue_and_print(conn, outbound_queue, True) 22 Fleet Operation Workspace Core Integration Toolkit 20964-000 Rev. C User's Manual