obstools.broker_listener module
Apache ActiveMQ Broker Listener Module
LDTObserverTools contains python ports of various LDT Observer Tools
Lowell Discovery Telescope (Lowell Observatory: Flagstaff, AZ) https://lowell.edu
This file contains the ActiveMQ_Listener class used by the
deveny_collfocus routine for retrieving current values from the LDT’s
ActiveMQ broker. This is kept separate so that an ImportError on stomp
simply causes this module to not import and the calling module can go about its
business.
- class obstools.broker_listener.ActiveMQ_Listener(config_file)[source]
Bases:
objectBroadcast (status) message listening class
This class listens to the ActiveMQ broker and places a parsed version of the desired broker messages into attributes accessible by the calling function. This class is adapted from similar ones used with the LORAX project, being developed at Lowell Observatory.
- Parameters:
config_file (
strorpathlib.Path) – The location of the configuration file to read
- class MyListener(parent)[source]
Bases:
ConnectionListenerClass for listening to the STOMPing
This listener runs asynchronously from the main body of the program through stomp’s threading functionality. When a broker message is received, it is parsed and placed into the
parentattribute(s) to be accessed whenever the main code needs it.- Parameters:
parent (
class) – The parent class into whose attributes values from the broker message are placed.
- on_error(message)[source]
Called by the STOMP connection when an ERROR frame is received.
- Parameters:
frame (Frame) – the stomp frame
- on_message(message)[source]
Called by the STOMP connection when a MESSAGE frame is received.
- Parameters:
frame (Frame) – the stomp frame