예제 #1
0
class RabbitMessageBase:
    """Base class for all RabbitMQ messaging."""

    def __init__(self, session):
        self.session = IMessageSession(session)
        self._channel = None

    @property
    def channel(self):
        if self._channel is None or not self._channel.is_open:
            connection = self.session.connect()
            self._channel = connection.channel()
            self._channel.exchange_declare(
                self.session.exchange, "direct", durable=False,
                auto_delete=False, nowait=False)
        return self._channel
예제 #2
0
class RabbitMessageBase:
    """Base class for all RabbitMQ messaging."""
    def __init__(self, session):
        self.session = IMessageSession(session)
        self._channel = None

    @property
    def channel(self):
        if self._channel is None or not self._channel.is_open:
            connection = self.session.connect()
            self._channel = connection.channel()
            self._channel.exchange_declare(self.session.exchange,
                                           "direct",
                                           durable=False,
                                           auto_delete=False,
                                           nowait=False)
        return self._channel
예제 #3
0
 def __init__(self, session):
     self.session = IMessageSession(session)
     self._channel = None
예제 #4
0
 def __init__(self, session):
     self.session = IMessageSession(session)
     self._channel = None