I have a Spring Cloud Data Flow (SCDF)
server running on Kubernetes cluster
with Kafka
as the message broker. Now I am trying to launch a Spring Cloud Task (SCT)
that writes to a topic in Kafka
. I would like the SCT to use the same Kafka
that SCDF
is using. This brings up two questions that I have and hope they can be answered:
- How to configure the SCT to use the same Kafka as SCDF?
- Is it possible to configure the SCT so that the Kafka server uri can be passed to the SCT automatically when it launches, similar to the data source properties that get passed to the SCT at launch?
As I could not find any examples on how to achieve this, help is very appreciated.
Edit: My own answer
This is how I get it working for my case. My SCT requires spring.kafka.bootstrap-servers
to be supplied. From SCDF's shell, I provide it as an argument --spring.kafka.bootstrap-servers=${KAFKA_SERVICE_HOST}:${KAFKA_SERVICE_PORT}
, where KAFKA_SERVICE_HOST
and KAFKA_SERVICE_PORT
are environment variables created by SCDF's k8s setup script.
This is how to launch the task within SCDF's shell
dataflow:>task launch --name sample-task --arguments "--spring.kafka.bootstrap-servers=${KAFKA_SERVICE_HOST}:${KAFKA_SERVICE_PORT}"