def __init__(self, host='localhost', port=61613, user='', passcode='', ver='1.1', prompt='> ', verbose=True, use_ssl=False, stdin=sys.stdin, stdout=sys.stdout): Cmd.__init__(self, 'Tab', stdin, stdout) ConnectionListener.__init__(self) self.prompt = prompt self.verbose = verbose self.user = user self.passcode = passcode self.__quit = False if ver == '1.0': self.conn = StompConnection10([(host, port)], wait_on_receipt=True) elif ver == '1.1': self.conn = StompConnection11([(host, port)], wait_on_receipt=True) elif ver == '1.2': self.conn = StompConnection12([(host, port)], wait_on_receipt=True) elif ver == 'multicast': self.conn = MulticastConnection() else: raise RuntimeError('Unknown version') if use_ssl: self.conn.set_ssl([(host, port)]) self.conn.set_listener('', self) self.conn.start() self.conn.connect(self.user, self.passcode, wait=True) self.transaction_id = None self.version = ver try: self.nversion = float(ver) except ValueError: self.nversion = 1.0 self.__subscriptions = {} self.__subscription_id = 1
def __init__(self, host='localhost', port=61613, user='', passcode='', ver='1.1', prompt='> ', verbose=True, heartbeats=(0, 0), use_ssl=False, ssl_key_file=None, ssl_cert_file=None, ssl_ca_file=None, stdin=sys.stdin, stdout=sys.stdout): Cmd.__init__(self, 'Tab', stdin, stdout) ConnectionListener.__init__(self) self.__start = True self.prompt = prompt self.verbose = verbose self.user = user self.passcode = passcode self.__quit = False if ver == "1.0": self.conn = StompConnection10([(host, port)]) elif ver == "1.1": self.conn = StompConnection11([(host, port)], heartbeats=heartbeats) elif ver == "1.2": self.conn = StompConnection12([(host, port)], heartbeats=heartbeats) elif ver == "multicast": self.conn = MulticastConnection() else: raise RuntimeError("Unknown version") if use_ssl: self.conn.set_ssl([(host, port)], key_file=ssl_key_file, cert_file=ssl_cert_file, ca_certs=ssl_ca_file) self.conn.set_listener('', self) self.conn.connect(self.user, self.passcode, wait=True) self.transaction_id = None self.version = ver try: self.nversion = float(ver) except ValueError: self.nversion = 1.0 self.__subscriptions = {} self.__subscription_id = 1
def increment_the_variable(self): try: self.stompClient = getNewStompConnection('', ConnectionListener()) except: log.error(''' Cannot connect to Stomp; make sure you're running a local ActiveMQ instance. You can start a docker container with ActiveMQ using the following : `docker run --name='activemq' -d -p 8161:8161 -p 61616:61616 -p 61613:61613 rmohr/activemq:5.10.0` ''') sys.exit(1)