bec_lib.tests.utils.ConnectorMock#

class ConnectorMock(bootstrap_server='localhost:0000', store_data=True)[source]#

Bases: ConnectorBase

Methods

delete

Delete a key

execute_pipeline

Execute a pipeline

get

Get a value

keys

Get keys that match the pattern

log_error

send an error as log

log_message

send a log message

log_warning

send a warning

lpush

Push a message to the left of the list

lrange

Get a range of values from the list

lset

Set a value in the list at the given index

pipeline

Create a pipeline for batch operations

poll_messages

Poll for new messages, receive them and execute callbacks

producer

raise_alarm

raise_warning

Raise a warning

raw_send

Send a raw message without using the BECMessage class

register

Register a callback for a topic or pattern

rpush

Push a message to the right of the list

send

Send a message

set

Set a value

set_and_publish

Set a value and publish it

shutdown

Shutdown the connector

unregister

Unregister a callback for a topic or pattern

xadd

Add a message to the stream

xrange

Read from the stream

xread

Read from the stream

delete(topic, pipe=None)[source]#

Delete a key

execute_pipeline(pipeline)[source]#

Execute a pipeline

get(topic, pipe=None)[source]#

Get a value

keys(*args, **kwargs)[source]#

Get keys that match the pattern

log_error(*args, **kwargs)[source]#

send an error as log

log_message(msg)#

send a log message

log_warning(msg)#

send a warning

lpush(topic, msg, pipe=None, max_size=None)[source]#

Push a message to the left of the list

lrange(topic, start, stop, pipe=None)[source]#

Get a range of values from the list

lset(topic: str, index: int, msgs: str, pipe=None) None[source]#

Set a value in the list at the given index

pipeline()[source]#

Create a pipeline for batch operations

poll_messages(*args, **kwargs)[source]#

Poll for new messages, receive them and execute callbacks

raise_warning(msg)#

Raise a warning

raw_send(topic, msg, pipe=None)[source]#

Send a raw message without using the BECMessage class

register(*args, **kwargs)[source]#

Register a callback for a topic or pattern

rpush(topic, msg, pipe=None)[source]#

Push a message to the right of the list

send(topic, msg, pipe=None)[source]#

Send a message

set(topic, msg, pipe=None, expire: int | None = None)[source]#

Set a value

set_and_publish(topic, msg, pipe=None, expire: int | None = None)[source]#

Set a value and publish it

shutdown()[source]#

Shutdown the connector

unregister(*args, **kwargs)[source]#

Unregister a callback for a topic or pattern

xadd(topic, msg_dict, max_size=None, pipe=None, expire: int | None = None)[source]#

Add a message to the stream

xrange(topic, min='-', max='+', pipe=None)[source]#

Read from the stream

xread(topic, id=None, count=None, block=None, pipe=None, from_start=False)[source]#

Read from the stream