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: object

Broadcast (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 (str or pathlib.Path) – The location of the configuration file to read

class MyListener(parent)[source]

Bases: ConnectionListener

Class 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 parent attribute(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

parse_deveny(status)[source]

Parse an XMLTODICT status message

Parameters:

status (dict) – Translated XML status message

Returns:

dict – The parsed status dictionary for this particular use case.