ProducerGroup
- class openmsistream.kafka_wrapper.ProducerGroup(config_path, kafkacrypto=None, **kwargs)
Bases:
LogOwner
Class for working with a group of producers sharing a single
kafkacrypto.KafkaCrypto
instance- Parameters:
config_path (
pathlib.Path
) – Path to the config file that should be used to define Producers in the groupkafkacrypto (
OpenMSIStreamKafkaCrypto
, optional) – TheOpenMSIStreamKafkaCrypto
object that should be used to instantiate Producers. Only needed if a single specificOpenMSIStreamKafkaCrypto
instance should be shared.
- property kafkacrypto
The KafkaCrypto object handling key passing and serialization for encrypted messages
- get_new_producer()
Return a new
OpenMSIStreamProducer
object. Call this function from a child thread to get thread-independent Producers. Note: this function just creates the Producer; closing it etc. must be handled by whatever calls this function.- Returns:
a Producer created using the config set in the constructor
- Return type:
- close()
Wrapper around
kafkacrypto.KafkaCrypto.close()
.
- classmethod get_command_line_arguments()
Anything extending this class should be able to access the “treat_undecryptable_as_plaintext” flag
- classmethod get_init_args_kwargs(parsed_args)
Get the list of init arguments and the dictionary of init keyword arguments for this class given a namespace of, for example, parsed arguments.
- Parameters:
parsed_args (argparse.Namespace) – A namespace containing entries needed to determine the init args and kwargs for this class
- Returns:
A list of init args
- Returns:
A dictionary of init kwargs