Created
May 12, 2022 08:04
-
-
Save lburgazzoli/6b7f75abc756ac962976ca2b1496a773 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// camel-k: language=groovy | |
// camel-k: dependency=camel-endpoint-dsl | |
def k = kafka("default-topic") | |
.brokers('{{KAFKA_URL}}') | |
.securityProtocol('SASL_SSL') | |
.saslMechanism('PLAIN') | |
.saslJaasConfig('org.apache.kafka.common.security.plain.PlainLoginModule required username="{{KAFKA_USR}}" password="{{KAFKA_PWD}}";') | |
.keySerializer('org.apache.kafka.common.serialization.StringSerializer') | |
.valueSerializer('org.apache.kafka.common.serialization.StringSerializer') | |
from('file://data?idempotent=true&delete=false&noop=true') | |
.unmarshal().json() | |
.split().body() | |
//.to('log:info?multiLIne=true') | |
.setHeader("kafka.KEY").simple('${body[event][key]}') | |
.setHeader("kafka.OVERRIDE_TOPIC").simple('${body[topic]}') | |
.setBody().simple('${body[event][value]}') | |
.marshal().json() | |
.to('log:info?multiLIne=true&showHeaders=true') | |
.to(k) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment