This project demonstrates how data could be streamed from Amazon RabbitMQ to a SASL/SCRAM enabled Amazon MSK, through Apache Camel.
- RabbitMQ is a popular open source message broker with a vast range of functionality such as flexible routing/dead letter exchanges/multi-protocol support.
- Apache Kafka is an open source highly scalable real-time messaging system used in event driven communications / distributed event processing .
- Apache Camel is an opensource integration framework supporting various enterprise integration patterns
- Integrate with AWS Secrets Manager.
- Amazon Rabbit MQ is setup to have public access (associated with a public subnet) and is listening on port 5671.
- MSK is setup with SASL/SCRAM authentication (https://docs.aws.amazon.com/msk/latest/developerguide/msk-password.html#msk-password-tutorial) in a private subnet.
- Apache Camel runs on an EC2 in a public subnet in the same VPC as Amazon MQ and Amazon MSK.
- Install Maven to build the project.
mvn clean install
- Install jre >=8 to run the project.
java -jar camel-kafka-sasl-scram-connector-1.0-SNAPSHOT.jar
-
Amazon RabbitMQ Pub/Sub Configuration: When publishing or subscribing to Amazon RabbitMQ queue below are some common important parameters to set for publishers and subscribers:
sslProtocol: TLS portNumber: 5671 userName: *** password: ******
- Checkout the
amazon.rabbitmq.connection
property in application.properties file.
- Checkout the
-
Amazon MSK Pub/Sub Configuration: For a SASL/SCRAM authentication based MSK below are the common important parameters to set for producers and consumers:
saslMechanism: SCRAM-SHA-512 securityProtocol=SASL_SSL sslEndpointAlgorithm=HTTPS saslJaasConfig=org.apache.kafka.common.security.scram.ScramLoginModule required username=fraser password=fraser-secret;
- Checkout the
amazon.msk.connection
property in application.properties file.
- Checkout the
Data Generator Route
: This route generates json events every 500ms and pushes it to a RabbitMQ queue (queue-name=logs)
Class Name: TestDataGenerator.java
RabbitMQ Subscriber Route
: This route polls the Rabbit MQ queue and pushes data to an MSK topic call iot-downstream.
Class Name: TestDataGenerator.java
MSK Consumer Route
: This route subscribes to the iot-downstream topic on MSK and logs the data.
Class Name: PubSubRouter.java
monitor/manage camel routes. Its available as a springboot actuator and is accessible at
- http://{your-ip-address}:8080/actuator/hawtio
- mvn clean install
- cd target
- java -jar camel-kafka-sasl-scram-connector-1.0-SNAPSHOT.jar