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

Set default SpEL to configure partition key expression for outbound messages #1040

Closed
ilayaperumalg opened this issue Aug 17, 2017 · 2 comments
Assignees
Labels
Milestone

Comments

@ilayaperumalg
Copy link
Contributor

From @ashvinkanani-dream on August 17, 2017 9:9

Hi,

I'd like to configure the partition key expression for all outbound messages being sent by any producer.

To achieve this I have configured following property

spring.cloud.stream.default.producer.partitionKeyExpression=payload.id

But, it didn't worked for me.
Also, when I configured the property for each output channel, it worked fine.

spring.cloud.stream.bindings.output-channel-1.producer.partitionKeyExpression=payload.id
spring.cloud.stream.bindings.output-channel-2.producer.partitionKeyExpression=payload.id

Reference

Copied from original issue: spring-cloud/spring-cloud-stream-binder-kafka#182

@ilayaperumalg ilayaperumalg self-assigned this Aug 17, 2017
@ilayaperumalg
Copy link
Contributor Author

Hi @ashvinkanani-dream

Thanks for reporting this.

It seems like the conversion (String to Expression) doesn't take place when binding the default producer's partitionKeyExpression into BindingProperties here

@ilayaperumalg ilayaperumalg added this to the 1.3.0.RC1 milestone Aug 17, 2017
ilayaperumalg added a commit to ilayaperumalg/spring-cloud-stream that referenced this issue Aug 17, 2017
 - When binding the default BindingProperties, we use RelaxedDataBinder without any specific conversion service. This makes the `String` to SpEL `Expression` conversion failing when the producer properties such as `partitionKey/SelectorExpression` are bound.
 - Update the underlying conversion service (which includes the SpELConverter via EnableBinding) into RelaxedDataBinder
 - Update test

Resolves spring-cloud#1040
ilayaperumalg added a commit to ilayaperumalg/spring-cloud-stream that referenced this issue Aug 17, 2017
 - When binding the default BindingProperties, we use RelaxedDataBinder without any specific conversion service. This makes the `String` to SpEL `Expression` conversion failing when the producer properties such as `partitionKey/SelectorExpression` are bound.
 - Update the underlying conversion service (which includes the SpELConverter via EnableBinding) into RelaxedDataBinder
 - Update test

Resolves spring-cloud#1040
@xuben
Copy link

xuben commented Apr 3, 2019

Hi, I ran into the same problem recently. I'm using 1.3.3.RELEASE of spring-cloud-stream. It's said that it's already fixed in #1041 . I checked the source code and the modification has already applied to it. I can't figure out why the problem still remains in my situation.

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

No branches or pull requests

3 participants