Ejemplo n.º 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
Ejemplo n.º 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
Ejemplo n.º 3
0
 def __init__(self, session):
     self.session = IMessageSession(session)
     self._channel = None
Ejemplo n.º 4
0
 def __init__(self, session):
     self.session = IMessageSession(session)
     self._channel = None