Key-Value - Output
Continuing from the last tutorial about inputs using key-values, we will use store entries as key-values. We can view this as the reverse of the previous tutorial.
Prerequisites
This guide uses local
Fluvio cluster. If you need to install it, please follow the instructions at here.
Dataflow
Overview
For this example, we will write a dataflow that tracks books in a library system. It will take a book from the source and return the book as a value combined with a barcode as the key. We will write a short hashing function that takes the title and hashes it into a barcode that will serve as the key for our sink.
Define the types
Like the previous example, we will need to define our types. This time, its a little shorter.
types:
book:
type: object
properties:
name:
type: string
year:
type: u32
author:
type: string
Topic List
The following is our list of topics.
topics:
new-book:
schema:
value:
type: book
books-in-system:
schema:
key:
type: string
value:
type: book
Source
The new-book
is the source topic.