Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Example for Kafka Streams branching with Flux #198

Open
benkeil opened this issue Feb 11, 2021 · 2 comments
Open

Example for Kafka Streams branching with Flux #198

benkeil opened this issue Feb 11, 2021 · 2 comments

Comments

@benkeil
Copy link

benkeil commented Feb 11, 2021

Can you please add an example how to use branching in a reactive way?

Predicate<String, Flux<Review>> testPredicate = (k, v) -> ???

@Bean
@SuppressWarnings("unchecked")
public Function<KStream<String, Value>, KStream<String, Review>[]> map() {
    return reviews -> reviews.branch(testPredicate);
}
@sobychacko
Copy link
Contributor

@benkeil Not sure what you mean here. Could you elaborate on the use case? For one thing, you cannot use reactive types with Kafka Streams functions. On the other hand, I don't see the need to use reactive types in the code above since you are operating on KStream and calling it's branch method. The branch method in KStream takes a predicate, but that is specific to that API. See the details here.

@benkeil
Copy link
Author

benkeil commented Mar 6, 2021

The predicate needs to return a boolean and I don't know how to write it in a way that the flux returns a boolean.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants