예제 #1
0
    def __init__(self,
                 host='localhost',
                 port=61613,
                 connect_headers={},
                 on_error=None,
                 on_disconnect=None,
                 on_connect=None,
                 reconnect_max_attempts=-1,
                 reconnect_timeout=1000):

        self.host = host
        self.port = port
        self.logger = logging.getLogger('TorStomp')

        self._connect_headers = connect_headers
        self._connect_headers['accept-version'] = self.VERSION
        self._heart_beat_handler = None
        self.connected = False
        self._disconnecting = False
        self._protocol = StompProtocol()
        self._subscriptions = {}
        self._last_subscribe_id = 0
        self._on_error = on_error
        self._on_disconnect = on_disconnect
        self._on_connect = on_connect

        self._reconnect_max_attempts = reconnect_max_attempts
        self._reconnect_timeout = timedelta(milliseconds=reconnect_timeout)
        self._reconnect_attempts = 0
예제 #2
0
 def setUp(self):
     self.protocol = StompProtocol()