Hello everyone, I would like to know if I can outp...
# troubleshooting
h
Hello everyone, I would like to know if I can output the result of datastream.addSource() to a collection? For example, List or Map, so that I can use it in another stream. For example, read the name from the database through a datastream and store it in a list, and then filter the data based on this name in a loop.
πŸ‘€ 1
r
It seems like you could do that via connecting the two streams via the
connect()
function based on constructing a stream from the elements you read from the database:
Copy code
// Get your names
val names = getNamesFromDatabase()
// Create a stream of your names
val nameStream = streamEnv.fromElements(names)

// Join your existing source with your names and do something
streamEnv
    .fromDataSource(...)
    .connect(nameStream)
    .process(DoSomethingFunction())
There are lots of ways to accomplish this depending on how you want to construct your job, timing, etc. but this is a very naive way to join two separate streams.
h
Copy code
Okay, thank you for your suggestion, I'll give it a try and let you know if it works.