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

Need information about GlobalKTable support #1119

Open
jamesforwardnwboxed opened this issue Nov 22, 2024 · 2 comments
Open

Need information about GlobalKTable support #1119

jamesforwardnwboxed opened this issue Nov 22, 2024 · 2 comments

Comments

@jamesforwardnwboxed
Copy link

jamesforwardnwboxed commented Nov 22, 2024

Issue description

Hi. I'm trying to migrate a Spring Boot based app to Micronaut. In Spring, we can do the following:

 @Bean
    public StreamsBuilderFactoryBean someKStreamBuilder(KafkaProperties kafkaProperties) {

        String applicationId = "my-desired-application-id";
        return new StreamsBuilderFactoryBean(createKStreamsConfig(applicationId, kafkaProperties));
    }

    @Bean
    public GlobalKTable<UUID, MyAvroEvent> myGlobalKTable(
        @Qualifier("someKStreamBuilder") StreamsBuilder streamsBuilder) {

        return streamsBuilder.globalTable("my-avro-event-topic", Materialized.as(""my-avro-event-topic-store"));
    }

which I can then use in my processing by getting the Read Only store, etc.

However, it looks like micronaut-kafka-streams will ONLY create streams for beans that return KStream objects. I see a couple of issues posted here, however I can't for the life of me in the documentation find a solution for the workaround for this. I need to have a GlobalKTable of a topic alone, not related to any other topology. in other words, after the globalTable is registered in the streamsBuilder, that's all I want.

What is the suggested approach in micronaut-kafka-streams here? The last thing I want is to have to create/define a dummy topic just to have a KStream object to return.

@graemerocher
Copy link
Contributor

seems what would be best is to enhance the module to do what you want. Code is open source and contributions are welcome

@jamesforwardnwboxed
Copy link
Author

jamesforwardnwboxed commented Nov 23, 2024

seems what would be best is to enhance the module to do what you want. Code is open source and contributions are welcome

Sure, I could do that and am happy to if needed, but what I'm asking is what is the current recommended approach by active maintainers? I could tweak whatever I want to work however I want, and I've done that plenty of times with other open source libraries, but if Micronaut has some opinionated recommendations, I'd rather follow them first rather than shoehorn in an approach to make sure I'm keeping things consistent, especially if there is already a solution.

I'm not saying Micronaut doesn't support it anyway, I'm just saying I can't find documentation on such a use-case. It may be missing docs or missing functionality, I just need that clarified.

I've got a workaround anyway which works for my use-case as I happen to need another Stream (I just create the global k tables with a separate ConfiguredStreamBuilder but in the KStream bean, so I pass all the ConfiguredStreamBuilders as parameters) but it wouldn't necessarily work if all I wanted were GlobalKTables in my app

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