Created
June 11, 2021 21:39
-
-
Save diogodanielsoaresferreira/a68c674081b169fc5f575a81f846fd19 to your computer and use it in GitHub Desktop.
Camel Routes - Step 7
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
//... | |
from("kafka:input_topic?brokers=localhost:9092&groupId=group1") | |
.unmarshal().json(UserMessage.class) | |
.filter(simple("${body.type} == 'chat'")) | |
.log("${body}") | |
.split(simple("${body.devices}")) | |
.log("${body}") | |
.end() | |
.marshal().json() | |
.to("kafka:output_topic?brokers=localhost:9092") | |
.to("direct:store_in_file"); | |
from("direct:store_in_file") | |
.unmarshal().json(UserMessage.class) | |
.choice() | |
.when(simple("${body.emitter} == 'John Doe'")) | |
.marshal().json().to("file:///home/diogoferreira/Desktop/Apache Camel Demo/getting-started/user-message?filename=events.json&fileExist=Append&appendChars=\\n") | |
.otherwise() | |
.marshal().json().to("file:///home/diogoferreira/Desktop/Apache Camel Demo/getting-started/john-doe-message?filename=events.json&fileExist=Append&appendChars=\\n") | |
.end(); | |
//... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment