hop.io

class hop.io.Deserializer(value)

An enumeration.

class hop.io.Metadata(topic: str, partition: int, offset: int, timestamp: int, key: Union[str, bytes], _raw: cimpl.Message)[source]

Broker-specific metadata that accompanies a consumed message.

class hop.io.Stream(auth=True, start_at=<ConsumerStartPosition.LATEST: 2>, persist=False)[source]

Defines an event stream.

Sets up defaults used within the client so that when a stream connection is opened, it will use defaults specified here.

Args:
auth: A bool or Auth instance. Defaults to loading from auth.load_auth()

if set to True. To disable authentication, set to False.

start_at: The message offset to start at in read mode. Defaults to LATEST. persist: Whether to listen to new messages forever or stop

when EOS is received in read mode. Defaults to False.

open(url, mode='r')[source]

Opens a connection to an event stream.

Args:

url: Sets the broker URL to connect to.

Kwargs:

mode: Read (‘r’) or write (‘w’) from the stream.

Returns:

An open connection to the client, either an adc Producer instance in write mode or an adc Consumer instance in read mode.

Raises:
ValueError: If the mode is not set to read/write or if more than

one topic is specified in write mode.