# Path: muranoagent/common/messaging/subscription.py
# class Subscription(object):
#     def __init__(self, connection, queue, prefetch_count, exception_func):
#     def __enter__(self):
#     def __exit__(self, exc_type, exc_val, exc_tb):
#     def get_message(self, timeout=None):
#     def _get(self, timeout=None):
#     def _receive(self, message_data, message):


import random
import ssl as ssl_module
import anyjson
import eventlet
import kombu
from oslo_service import sslutils
from muranoagent.common.messaging import subscription
            'amqp://{0}:{1}@{2}:{3}/{4}'.format(
                login,
                password,
                host,
                port,
                virtual_host
            ), ssl=ssl_params, heartbeat=heartbeat_rate
        )
        self._channel = None
        self._connected = False
        self._exception = None

    def __enter__(self):
        self.connect()
        return self

    def __exit__(self, exc_type, exc_val, exc_tb):
        if exc_type:
            self._connected = False
        else:
            self.close()
        return False

    def connect(self):
        self._connection.connect()
        self._channel = self._connection.channel()
        if not self._connected:
            self._connected = True
            eventlet.spawn(self._heartbeater)


# Path: muranoagent/common/messaging/subscription.py
# class Subscription(object):
#     def __init__(self, connection, queue, prefetch_count, exception_func):
#     def __enter__(self):
#     def __exit__(self, exc_type, exc_val, exc_tb):
#     def get_message(self, timeout=None):
#     def _get(self, timeout=None):
#     def _receive(self, message_data, message):


# Path: muranoagent/common/messaging/mqclient.py
import random
import ssl as ssl_module
import anyjson
import eventlet
import kombu
from oslo_service import sslutils
from muranoagent.common.messaging import subscription

            'amqp://{0}:{1}@{2}:{3}/{4}'.format(
                login,
                password,
                host,
                port,
                virtual_host
            ), ssl=ssl_params, heartbeat=heartbeat_rate
        )
        self._channel = None
        self._connected = False
        self._exception = None

    def __enter__(self):
        self.connect()
        return self

    def __exit__(self, exc_type, exc_val, exc_tb):
        if exc_type:
            self._connected = False
        else:
            self.close()
        return False

    def connect(self):
        self._connection.connect()
        self._channel = self._connection.channel()
        if not self._connected:
            self._connected = True
            eventlet.spawn(self._heartbeater)


    def close(self):