betfsm.HTTPEventReceiver

clear()

Clears the qeueue

get_instance(channel_name, queue_size=10) classmethod

One singleton queue per topic.

Parameters:
  • channel_name (str) –

    name of the topic to subscribe to

  • queue_size (int, default: 10 ) –

    size of the queue (related to maximum concurrent events, i.e. sample time in relation to the events generated)

Returns: Singleton instance of EventQueueSubscriber.

has_event(target_strings)

Looks for an event in the queue that matches one of the target_strings. Reads from the oldest to the newest element in the queueu. Returns the matching event and None if no event matches. It does not consume the matching event.

has_recent_event(target_strings, max_age_seconds)

Looks for an event in the queue that matches one of the target_strings. Reads from the oldest to the newest element in the queueu. Returns the matching event and None if no event matches. It only returns events that are at most max_age_seconds old.
This can be useful to avoid stale events. It does not consume the matching event.

log_queue(max_items=20)

Logs a snapshot of queue.

poll_for(target_strings)

Looks for an event in the queue that matches one of the target_strings. Reads from the oldest to the newest element in the queueu. Returns the matching event and None if no event matches. It consumes the matching event.

poll_recent_for(target_strings, max_age_seconds)

Looks for an event in the queue that matches one of the target_strings. Reads from the oldest to the newest element in the queueu. Returns the matching event and None if no event matches. It only returns events that are at most max_age_seconds old.
This can be useful to avoid stale events.
It consumes the matching event.

size()

Size of the queue