Migrating Kafka Python Applications to HPE Ezmeral Data Fabric Streams
With some modification, you can use existing confluent-kafka python applications to consume and produce topics in HPE Ezmeral Data Fabric Streams. The HPE Ezmeral Data Fabric Streams Python Client is a binding for Apache librdkafka that works with HPE Ezmeral Data Fabric Streams.
- Install the HPE Ezmeral Data Fabric Streams Python Client. NOTEThis required that you also install and configure the HPE Ezmeral Data Fabric Streams C Client. See Configuring the HPE Ezmeral Data Fabric Streams C Client.
- Do one of
the following depending on whether you are using the EEP 5.0 (or higher) HPE Ezmeral Data Fabric Streams Python
Client or the EEP 3.0 (or higher) HPE Ezmeral Data Fabric Streams Python Client.
- If you are using HPE Ezmeral Data Fabric Streams Python EEP 5.0 (or higher), skip this step. The references to
confluent_kafka
should be retained. - If you are using HPE Ezmeral Data Fabric Streams Python EEP 3.0 (or higher), update import statements to refer
to the MapR Stream Python API. References to
confluent_kafka
should be updated tomapr_streams_python
.NOTEFor example, updatefrom confluent_kafka import Consumer
tofrom mapr_streams_python import Consumer
.
- If you are using HPE Ezmeral Data Fabric Streams Python EEP 5.0 (or higher), skip this step. The references to
- When you refer to a topic in the application code, include the path and name of the stream
in which the topic is located:
/<path and name of stream>:<name of topic>
For example, you might have a stream in a HPE Ezmeral Data Fabric cluster that is named stream_A, and the stream might be in a volume named IoT and in a directory named automobile_sensors. You want to redirect a producer application to a topic in that stream. The syntax of the path to the topic might look like this:
/mapr/IoT/automobile_sensors/stream_A:<name of topic>
.NOTEOptionally, use thestreams.consumer.default.stream
andstreams.producer.default.stream
configuration parameters. When you configure these parameters, applications can specify just the topic name to write or read from the default stream. - Review the APIs that are supported and make changes to your application, as needed. See API for HPE Ezmeral Data Fabric Streams Python Client.
- See Configuration Properties for HPE Ezmeral Data Fabric Streams Python Client for the list of supported configuration
parameters and make changes to your application, as needed. NOTESSL-related configuration parameters are ignored. When you set these parameters, the HPE Ezmeral Data Fabric Streams Client issues a warning indicating that the parameters are not supported.