-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding example Kafka consumer/producer route from Apache examples
- Loading branch information
Showing
3 changed files
with
117 additions
and
1 deletion.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package com.redhat.naps.launch; | ||
|
||
import jakarta.enterprise.context.ApplicationScoped; | ||
import org.apache.camel.builder.RouteBuilder; | ||
|
||
@ApplicationScoped | ||
public class Application extends RouteBuilder { | ||
@Override | ||
public void configure() throws Exception { | ||
// produces messages to kafka | ||
from("timer:foo?period={{timer.period}}&delay={{timer.delay}}") | ||
.routeId("FromTimer2Kafka") | ||
.setBody().simple("Message #${exchangeProperty.CamelTimerCounter}") | ||
.to("kafka:{{kafka.topic.name}}") | ||
.log("Message correctly sent to the topic! : \"${body}\" "); | ||
|
||
// kafka consumer | ||
from("kafka:{{kafka.topic.name}}") | ||
.routeId("FromKafka2Seda") | ||
.log("Received : \"${body}\"") | ||
.to("seda:kafka-messages"); | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
|
||
# Use Strimzi as it's power architecture compatible | ||
quarkus.kafka.devservices.provider = strimzi | ||
|
||
# Kafka topic Name | ||
kafka.topic.name=test | ||
|
||
# Kafka brokers in native test | ||
%prod.camel.component.kafka.brokers=${kafka.bootstrap.servers} | ||
|
||
# How often should the messages be generated and pushed to Kafka Topic | ||
timer.period = 10000 | ||
timer.delay = 10000 | ||
|
||
# Kafka instance without Authentication | ||
#camel.component.kafka.brokers=${brokers} | ||
|
||
# uncomment to set Kafka instance with SASL Plain | ||
#camel.component.kafka.brokers=${brokers} | ||
#camel.component.kafka.security-protocol=SASL_SSL | ||
#camel.component.kafka.sasl-mechanism=PLAIN | ||
#camel.component.kafka.sasl-jaas-config=org.apache.kafka.common.security.plain.PlainLoginModule required username="${id}" password="${secret}"; | ||
|
||
# uncomment to set Kafka instance with SASL Oauth Bearer | ||
#camel.component.kafka.brokers = ${brokers} | ||
#camel.component.kafka.security-protocol = SASL_SSL | ||
#camel.component.kafka.sasl-mechanism = OAUTHBEARER | ||
#camel.component.kafka.sasl-jaas-config = org.apache.kafka.common.security.oauthbearer.OAuthBearerLoginModule required \ | ||
# oauth.client.id="${id}" \ | ||
# oauth.client.secret="${secret}" \ | ||
# oauth.token.endpoint.uri="${token}" ; | ||
#camel.component.kafka.additional-properties[sasl.login.callback.handler.class] = io.strimzi.kafka.oauth.client.JaasClientOauthLoginCallbackHandler | ||
|
||
|
||
################################### | ||
# Kubernetes specific | ||
################################### | ||
# secrets | ||
#quarkus.kubernetes-config.enabled=true | ||
#getting secrets while deploying to kubernetes | ||
#quarkus.kubernetes-config.namespace=test | ||
#quarkus.kubernetes-config.secrets.enabled=true | ||
#quarkus.kubernetes-config.secrets=camel-kafka | ||
|
||
# creating container with jib | ||
#quarkus.container-image.build=true | ||
#quarkus.kubernetes.deployment-target=kubernetes | ||
#quarkus.container-image.group=<YOUR_IMAGE_GROUP> | ||
#quarkus.container-image.registry=<YOUR_REGISTRY_URL> | ||
|
||
# Uncomment to trust self signed certificates if they are presented by the Kubernetes API server | ||
#quarkus.kubernetes-client.trust-certs=true | ||
|
||
# Uncomment to set resource limits | ||
#quarkus.kubernetes.resources.requests.memory=64Mi | ||
#quarkus.kubernetes.resources.requests.cpu=250m | ||
#quarkus.kubernetes.resources.limits.memory=512Mi | ||
#quarkus.kubernetes.resources.limits.cpu=1000m | ||
|
||
################################### | ||
# OpenShift specific | ||
################################### | ||
# secrets | ||
#quarkus.kubernetes-config.enabled=true | ||
#getting secrets while deploying to kubernetes | ||
#quarkus.kubernetes-config.namespace=test | ||
#quarkus.kubernetes-config.secrets.enabled=true | ||
#quarkus.kubernetes-config.secrets=camel-kafka | ||
|
||
# creating container for openshift | ||
#quarkus.container-image.build=true | ||
#quarkus.kubernetes.deployment-target=openshift | ||
|
||
# OpenShift | ||
#quarkus.openshift.image-pull-policy=IfNotPresent | ||
|
||
# Uncomment to set resource limits | ||
#quarkus.openshift.resources.requests.memory=64Mi | ||
#quarkus.openshift.resources.requests.cpu=250m | ||
#quarkus.openshift.resources.limits.memory=512Mi | ||
#quarkus.openshift.resources.limits.cpu=1000m |