Created
September 2, 2020 12:44
-
-
Save chanakaudaya/efe8dfed2558811f0316a7839dbfef57 to your computer and use it in GitHub Desktop.
Sample siddhi application to read from a Kafka topic and publish through a WebSocket server
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
@App:name("KafkaToWebSocket") | |
@App:description('Consume events from a Kafka Topic and log the messages on the console.') | |
@source(type='kafka', | |
topic.list='productions', | |
threading.option='single.thread', | |
group.id="group1", | |
bootstrap.servers='localhost:9092', | |
@map(type='json')) | |
define stream SweetProductionStream (name string, amount double); | |
@sink(type='websocket-server', host='localhost', port='8025', | |
@map(type='json')) | |
define stream LowProductionAlertStream (name string, amount double); | |
@sink(type='log') | |
define stream OutputStream (name string, amount double); | |
from SweetProductionStream | |
select str:upper(name) as name, amount | |
insert into OutputStream; | |
from SweetProductionStream[amount < 500] | |
select str:upper(name) as name, amount | |
insert into LowProductionAlertStream; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment