0

Basically, I am using CoFlatMapFunction (https://ci.apache.org/projects/flink/flink-docs-stable/api/java/org/apache/flink/streaming/api/functions/co/CoFlatMapFunction.html) to filter a stream and change the filter parameters at runtime and I am using Flink for that. I want to do the same using Apache Edgent TStream (https://edgent.incubator.apache.org/javadoc/latest/org/apache/edgent/topology/TStream.html), but it does not have CoFlatMapFunction. If I use Union it will not work because the streams are different and I am not allowed to do union. If I use Filter I will not have the dynamic behavior that I want. Any suggestion?

Thanks

Felipe
  • 7,013
  • 8
  • 44
  • 102

1 Answers1

2

Using Flink you can force a Union on streams of different types by using Either. It's a bit hacky, but it seems like it could work with Apache Edgent as well.

Updated:

I'm just learning about Edgent, but it seems to have a notion of control streams: https://edgent.apache.org/recipes/recipe_adaptable_filter_range.html.

David Anderson
  • 39,434
  • 4
  • 33
  • 60
  • Sorry, but it is still not clear how to do this hacky in Edgent because I cannot find anything similar to `Either` on Apache Edgent (https://edgent.incubator.apache.org/javadoc/latest/org/apache/edgent/oplet/core/Union.html) – Felipe Dec 21 '18 at 10:05
  • The Either monad doesn't depend on Flink. I'm just assuming you can take one of the implementations out there and make it work with Edgent. – David Anderson Dec 21 '18 at 10:39
  • Hi, I could implement the Either approach using Flink-core library (https://github.com/felipegutierrez/explore-rpi/blob/master/src/main/java/org/sense/edgent/app/TempSensorUnionMqttApp.java). But now I don't know how to implement the union. Do you have any clue? Thanks – Felipe Dec 21 '18 at 12:53
  • I saw now your update. Thanks. It is working like I asked on my question – Felipe Dec 21 '18 at 13:20