Event-driven architecture extension for CKAN.
ckanext-consumer allows your CKAN instance to react to external events. It listens to a Kafka queue, consumes CloudEvents (or standard JSON), and dispatches them to registered Python functions in your other CKAN extensions.
- Consumer acts as the worker/consumer process (
ckan consumer consume). - It discovers other plugins implementing the
IConsumerinterface. - It routes incoming Kafka messages to the correct plugin based on the Topic Name.
-
Install the extension:
pip install -e . -
Install dependencies:
pip install -r requirements.txt
-
Enable the plugin in your
ckan.ini:ckan.plugins = ... consumer
Add the following settings to your ckan.ini file.
ckan.consumer.kafka.bootstrap.servers = your-kafka-broker:9092 ckan.consumer.kafka.group_id = ckan_consumer_prod ckan.consumer.kafka.client.id = ckan_instance_1
ckan.consumer.kafka.security.protocol = SASL_SSL
ckan.consumer.kafka.sasl.mechanisms = PLAIN
ckan.consumer.kafka.sasl.username = your_username ckan.consumer.kafka.sasl.password = your_password
ckan.consumer.kafka.session.timeout.ms = 45000 ckan.consumer.kafka.auto.offset.reset = earliest