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

Multi module streams configuration #2972

Open
gdonoso94 opened this issue Jul 15, 2024 · 6 comments
Open

Multi module streams configuration #2972

gdonoso94 opened this issue Jul 15, 2024 · 6 comments

Comments

@gdonoso94
Copy link

gdonoso94 commented Jul 15, 2024

Hello,

I'm not sure this should be considered a bug, it's more a how-to question.

I have a multi module project, consisting of multiple gradle modules where every module create different consumers and producers using a RabbitMQ broker binding. The consumer functions, bindings and binders are defined in the global application.yaml file.

In an attempt of structure better the project, I've split the config in separate application.yaml files, one under each module resources', only containing the needed module related configuration.

When there are multiple application.yaml files, these are combined and, since "spring.cloud.stream.function.definition" is a string, it get's overwritten by the different application.yaml files, therefore making impossible to split the configuration files in the project.

Digging a little bit in this repo, I've seen the defintions are obtained and split here, and I was wondering if it could be possible to have the definitions declared as an array in the config, so it can be extended when having multiple yaml configuration files. In my projects I've used @ConfigurationProperties for this and it's something I believe it could help here.

I would be more than happy to help with a PR for this but I need some guidance, this would be the first open source project I collaborate with and I'm pretty sure I'm missing something.

@gdonoso94
Copy link
Author

Any thoughts? 🤔

@olegz
Copy link
Contributor

olegz commented Aug 9, 2024

I personally have no tried it nor have we had any requests like this.
You can define multiple function definitions in a single property by delimiting them by semicolon (i.e., s.c.s.function.definition=foo;bar;baz), but I am not sure that is what you are looking for.
Perhaps contributing and submitting a PR would be better so we can review and understand better what you are trying to accomplish.

@gdonoso94
Copy link
Author

gdonoso94 commented Aug 9, 2024

Hi Oleg, thanks for your response

I know I can define multiple function definitions. The problem arises when multiple configuration yaml define those. The yaml are combined and the s.c.s.function.definition gets overriden... What would be interesting is that property to be an array instead of a String, so it can be concatenated...

@olegz olegz added this to the 4.2.0-RC1 milestone Oct 9, 2024
@olegz
Copy link
Contributor

olegz commented Oct 9, 2024

@gdonoso94 I am having hard time reproducing it. In fact I see a different behavior then you describe.

So, here is what I have:
Module A:

  • I have MyConfiguration class which has name and 'id properties
  • I have application.properties defining values for name property - "Bob"

Module B:

  • I have application.properties defining values for id property - "123"

Module B is a dependency to Module A and when i run Module A MyConfiguration gets initialised only with name property, but no id.
Now. . . if I remove application.properties from Module A and run Module A again, MyConfiguration gets initialised only with id property, but no name.

In other words, i don't see an override, rather one configuration or the other gets picked up.

Perhaps my setup does not exactly re[resent yours, so may be you can create a small reproducible sample that I can play with.

@gdonoso94
Copy link
Author

Hi @olegz , thanks for your response. I will try to provide some minimal example as soon as I find some spare time.

@olegz
Copy link
Contributor

olegz commented Dec 19, 2024

@gdonoso94 Any updates?

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

No branches or pull requests

2 participants