# Path: pq/mq.py
# class BaseComponent:
# 
#     def __init__(self, backend):
#         self.backend = backend
#         self.logger = self.backend.logger
# 
#     @property
#     def cfg(self):
#         return self.backend.cfg
# 
#     @property
#     def _loop(self):
#         return self.backend._loop
# 
#     def encode(self, message, serializer=None):
#         """Encode a message"""
#         serializer = serializer or self.cfg.message_serializer
#         return serializers[serializer].encode(message)
# 
#     def decode(self, data, serializer=None):
#         """Decode a message"""
#         serializer = serializer or self.cfg.message_serializer
#         return serializers[serializer].decode(data)


from logging import getLogger
from .mq import BaseComponent
        super().__init__(backend)
        self.logger = getLogger('pulsar.%s' % self.name)
        self._closing_waiter = None

    def __str__(self):
        return self.name

    def __repr__(self):
        return '%s %s' % (self, self.backend)

    @property
    def name(self):
        return self.__class__.__name__.lower()

    @property
    def _loop(self):
        return self.backend._loop

    @property
    def manager(self):
        return self.backend.manager

    @property
    def broker(self):
        return self.backend.broker

    @property
    def channels(self):
        return self.backend.channels


# Path: pq/mq.py
# class BaseComponent:
# 
#     def __init__(self, backend):
#         self.backend = backend
#         self.logger = self.backend.logger
# 
#     @property
#     def cfg(self):
#         return self.backend.cfg
# 
#     @property
#     def _loop(self):
#         return self.backend._loop
# 
#     def encode(self, message, serializer=None):
#         """Encode a message"""
#         serializer = serializer or self.cfg.message_serializer
#         return serializers[serializer].encode(message)
# 
#     def decode(self, data, serializer=None):
#         """Decode a message"""
#         serializer = serializer or self.cfg.message_serializer
#         return serializers[serializer].decode(data)


# Path: pq/consumer.py
from logging import getLogger
from .mq import BaseComponent

        super().__init__(backend)
        self.logger = getLogger('pulsar.%s' % self.name)
        self._closing_waiter = None

    def __str__(self):
        return self.name

    def __repr__(self):
        return '%s %s' % (self, self.backend)

    @property
    def name(self):
        return self.__class__.__name__.lower()

    @property
    def _loop(self):
        return self.backend._loop

    @property
    def manager(self):
        return self.backend.manager

    @property
    def broker(self):
        return self.backend.broker

    @property
    def channels(self):
        return self.backend.channels


    def start(self, worker):