yr.fnruntime.Producer

Contents

yr.fnruntime.Producer#

class yr.fnruntime.Producer#

Bases: object

Producer interface class.

Examples

>>> try:
...     producer_config = ProducerConfig(
...         delay_flush_time=5,
...         auto_clean_up=True,
...     )
...     producer = yr.create_stream_producer("streamName", producer_config)
...     # .......
...     data = b"hello"
...     element = yr.Element(data=data, id=0)
...     producer.send(element)
...     producer.flush()
...     producer.close()
... except RuntimeError as exp:
...     # .......
...     pass

Initialize a Producer instance.

Methods

__init__

Initialize a Producer instance.

close

Closing the producer will trigger an automatic flush of the data buffer and indicate that the data buffer is no longer in use.

send

The Producer sends data, which is first placed into a buffer.