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

dynamically bound sources #1089

Closed
Shohou opened this issue Oct 4, 2017 · 4 comments
Closed

dynamically bound sources #1089

Shohou opened this issue Oct 4, 2017 · 4 comments

Comments

@Shohou
Copy link

Shohou commented Oct 4, 2017

It seems strange to me that there is dynamically bound destinations, but no dynamically bound sources. Is there a reason for that?

It seems to be easy implementable by copying BinderAwareChannelResolver, BeanFactoryMessageChannelDestinationResolver, DynamicDestinationsBindable, renaming them and changing logic to create inputs instead of outputs

@viniciusccarvalho
Copy link
Contributor

@Shohou How would a dynamic source work? For destinations the concept is to support routers so that messages with different payload/headers would map to different endpoints. Now for sources? What does that mean, how you switch sources? Based on what criteria?

There's a new story on allowing programmatically creation of sources instead of just relying on @StreamListener if this is what you meant, we are addressing this for 2.0

@Shohou
Copy link
Author

Shohou commented Oct 5, 2017

@viniciusccarvalho Is there a way to define Input with channel name not hard coded into the application? Let's say I have the application which I want to deploy multiple times as multiple nodes of some service and attach each node to the different channel. Channel name must be configurable somehow, for example it could be based on spring.application.name plus some prefix. Is it possible right now? I couldn't find.

@artembilan
Copy link
Contributor

@Shohou ,

Seems for me you are mixing MessageChannel bean in the application internals with the external destination. As far as I see you are saying that you "want to deploy multiple times", that sounds like you really have only one compiled code base. I really don't see reason to make the channel bean name dynamically determined - it is only for internal logic. See Spring Integration for more information.

Looks like what you need is called binding in Spring Cloud Stream. That is definitely an external destination, e.g. Kafka topic, to which we bind our internal message channel. And that is already indeed can be configured in the application.properties: https://docs.spring.io/spring-cloud-stream/docs/Ditmars.RELEASE/reference/htmlsingle/#binding-properties. Seek for the:

spring.cloud.stream.bindings.input.destination=ticktock

where input is a channel bean name, and ticktock is a destination in the target binder system - Kafka topic, RabbitMQ exchange, Hazelcast topic, AWS Kinesis stream etc.

Does it make sense to you?

@Shohou
Copy link
Author

Shohou commented Oct 6, 2017

somehow i missed destination property... or well... its because of evolution of some ideas... anyway destination solves my problem

Thank you!

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

3 participants