Exemple #1
0
    def __init__(self, context: Context, publish_queue: str = None,
                 subscribe_queue: str = None):
        """
        Class initializer
        :param context: connection details
        :type context: :class:`.Context`
        :param publish_queue: name of the publish queue
        :type publish_queue: `str`
        """
        super().__init__(context)

        # Keep a copy here - lots of re-use
        self.timeout = context.timeout()

        # Initialise the catalog
        self.catalog = catalog.MessageCatalog()

        if not publish_queue:
            # Publish not over-ridden so use context version
            publish_queue = context.feeds()

        self.start_subscriber(queue=rabbitmq.RabbitQueue(subscribe_queue))
        self.start_publisher(queue=rabbitmq.RabbitQueue(publish_queue))

        if subscribe_queue:
            self.command_queue = super().mktemp_queue()
        else:
            self.command_queue = self.subscriber.sub_queue
    def __init__(self, context: Context, publish_queue: str = None,
                 subscribe_queue: str = None, max_msg_size: int = 2*1024*1024):
        """
        Class initializer
        :param context: connection details
        :type context: :class:`.Context`
        :param publish_queue: name of the publish queue
        :type publish_queue: `str`
        :param max_msg_size: maximum permissible message length
        :type max_msg_size: `int`
        """
        super(Messenger, self).__init__(context)

        # Max size of a message for dispatch
        self.max_msg_size = max_msg_size

        # Keep a copy here - lots of re-use
        self.timeout = context.timeout()

        if not publish_queue:
            # Publish not over-ridden so use context version
            publish_queue = context.feeds()

        self.start_subscriber(queue=rabbitmq.RabbitQueue(subscribe_queue))
        self.start_publisher(queue=rabbitmq.RabbitQueue(publish_queue))

        # Initialise the catalog with the target subscribe queue
        self.catalog = catalog.MessageCatalog(context.user(), self.get_subscribe_queue())
Exemple #3
0
    def __init__(self,
                 context: Context,
                 publish_queue: str = None,
                 subscribe_queue: str = None,
                 max_msg_size: int = 2 * 1024 * 1024):
        '''Class initializer'''
        super(Messenger, self).__init__(context)

        #Max size of a message for dispatch
        self.max_msg_size = max_msg_size

        #Keep a copy here - lots of re-use
        self.timeout = context.timeout()

        if not publish_queue:
            #Publish not over-ridden so use context version
            publish_queue = context.feeds()

        self.start_subscriber(queue=rabbitmq.RabbitQueue(subscribe_queue))
        self.start_publisher(queue=rabbitmq.RabbitQueue(publish_queue))

        #Initialise the catalog with the target subscribe queue
        self.catalog = catalog.MessageCatalog(context.user(),
                                              self.get_subscribe_queue())