bec_lib.connector.ConnectorBase#
- class ConnectorBase(store)[source]#
Bases:
PubSubInterface
,StoreInterface
ConnectorBase defines the interface for a connector
Methods
Delete a key
Execute a pipeline
Get a value
Get keys that match the pattern
send an error as log
send a log message
send a warning
Push a message to the left of the list
Get a range of values from the list
Set a value in the list at the given index
Create a pipeline for batch operations
Poll for new messages, receive them and execute callbacks
Raise a warning
Send a raw message without using the BECMessage class
Register a callback for a topic or pattern
Push a message to the right of the list
Send a message
Set a value
Set a value and publish it
Shutdown the connector
Unregister a callback for a topic or pattern
Add a message to the stream
Read from the stream
Read from the stream
- abstract delete(topic, pipe=None)#
Delete a key
- abstract execute_pipeline(pipeline)#
Execute a pipeline
- abstract get(topic: str, pipe=None)#
Get a value
- abstract keys(pattern: str) list #
Get keys that match the pattern
- abstract lpush(topic: str, msg: str, pipe=None, max_size: int | None = None, expire: int | None = None) None #
Push a message to the left of the list
- abstract lrange(topic: str, start: int, end: int, pipe=None)#
Get a range of values from the list
- abstract lset(topic: str, index: int, msg: str, pipe=None) None #
Set a value in the list at the given index
- abstract pipeline()#
Create a pipeline for batch operations
- abstract poll_messages(timeout=None)#
Poll for new messages, receive them and execute callbacks
- abstract raw_send(topic: str, msg: bytes) None #
Send a raw message without using the BECMessage class
- abstract register(topics=None, patterns=None, cb=None, start_thread=True, **kwargs)#
Register a callback for a topic or pattern
- abstract rpush(topic: str, msg: str, pipe=None) int #
Push a message to the right of the list
- abstract send(topic: str, msg: BECMessage) None #
Send a message
- abstract set(topic: str, msg, pipe=None, expire: int | None = None) None #
Set a value
- set_and_publish(topic: str, msg, pipe=None, expire: int | None = None) None [source]#
Set a value and publish it
- abstract unregister(topics=None, pattern=None, cb=None)#
Unregister a callback for a topic or pattern
- abstract xadd(topic: str, msg_dict: dict, max_size=None, pipe=None, expire: int | None = None)#
Add a message to the stream
- abstract xrange(topic: str, min: str, max: str, count: int | None = None, pipe=None)#
Read from the stream
- abstract xread(topic: str, id: str | None = None, count: int | None = None, block: int | None = None, pipe=None, from_start=False) list #
Read from the stream