parsers.mq_listeners package

parsers.mq_listeners.rabbit_listener module

parsers.mq_listeners.rabbit_listener.rabbit_listener(host, port, parser)

A listener function that connects to a RabbitMQ server, listens to requests, parses them and publishes back a message with parsed data The listener uses the field to listen to the topic ‘parse.#.<field>.#’ for parse requests and publishes them back with the ‘save.<field>’ topic

Parameters
  • host – The host of the RabbitMQ server

  • port – The port of the RabbitMQ server

  • parser – A parser function or callable class, has a _field attribute that indicates which field it paarses

Module contents

This package stores all the listener functions that connect to different MQs when running parsers as a service Supports RabbitMQ by default, additional listeners can be added using the @listener decorator

parsers.mq_listeners.listener(scheme)

A decorator used to denote a function or a callable class that serves as a listener to a MQ server. By default, a function or callable class is passed host, port and parser (a function/class as indicated in parser_agents) as arguments

Parameters

scheme – The scheme of the MQ server which the listener connects to