Skip to content

Latest commit

 

History

History
61 lines (40 loc) · 1.28 KB

File metadata and controls

61 lines (40 loc) · 1.28 KB

Regex Example

In this example, we'll import the regex crate to demonstrate adding external dependencies for inline functions. We'll use the regex function to identify generation-z based on their year of birth.

Run DataFlow

With the dataflow.yaml file in the current directory, run the following commands:

sdf run

Test DataFlow

The sample data file used to run this test ./sample-data/data.txt has the following records:

{"name": "John", "born": 1996}
{"name": "Alice", "born": 1998}
{"name": "Bob", "born": 2011}
{"name": "Michael", "born": 2018}

Produce the data to the person topic:

fluvio produce person -f ./sample-data/data.txt

Checkout the data in person topic:

fluvio consume person -Bd

Consume from gen-z to retrieve the result:

fluvio consume gen-z -Bd
{"name": "Alice", "born": 1998}
{"name": "Bob", "born": 2011}

Note: the regex filter removes people born outside of gen-z age group.

Clean-up

Exit sdf terminal and clean-up. The --force flag removes the topics:

sdf clean --force