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 __init__(self, host_and_ports=None, username=None, passwd=None): StompConnection10.__init__(self, reconnect_attempts_max=10) ActiveMQ.__init__(self, host_and_ports, username, passwd) self.conn = Connection10(self.host_and_ports) self.conn.connect(self.username, self.passwd)