Created
December 16, 2020 08:04
-
-
Save chanakaudaya/b51ded16e8c1fd78963c5c48d214eb72 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
@App:name('TailFileRegex') | |
@App:description('Tails a file using a regex and does a simple transformation.') | |
@source(type='file', mode='REGEX', | |
file.uri='file:/Users/chanaka/my-experiments/wso2-si-samples/noisy_data.txt', | |
begin.regex='\<', end.regex='\>', | |
tailing='true', | |
@map(type='text', fail.on.missing.attribute = 'false', regex.A='(\w+)\s([-0-9]+)',regex.B='volume\s([-0-9]+)', @attributes(symbol = 'A[1]',price = 'A[2]',volume = 'B'))) | |
define stream StockStream (symbol string, price float, volume long); | |
@sink(type = 'log') | |
define stream LogStream (symbol string, price float, volume long); | |
from StockStream[NOT(symbol is null)] | |
select str:upper(symbol) as symbol, price, volume | |
insert into LogStream; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment