See spring-attic/spring-cloud-stream-binder-rabbit#83 (comment)
With the functional model, the payload is converted before the channel interceptor (Rabbit Binder) can evaluate expressions against the payload.
Conversion needs to be deferred.
@SpringBootApplication
public class Rbgh83Application {
public static void main(String[] args) {
SpringApplication.run(Rbgh83Application.class, args);
}
@Bean
Supplier<Foo> out() {
return () -> new Foo();
}
public static class Foo {
public String getFoo() {
return "bar";
}
}
}
spring.cloud.stream.rabbit.bindings.out-out-0.producer.routing-key-expression=payload.foo
logging.level.org.springframework.amqp.rabbit=debug
Caused by: org.springframework.expression.spel.SpelEvaluationException: EL1008E: Property or field 'foo' cannot be found on object of type 'byte[]' - maybe not public or not valid?
at org.springframework.expression.spel.ast.PropertyOrFieldReference.readProperty(PropertyOrFieldReference.java:217)
at org.springframework.expression.spel.ast.PropertyOrFieldReference.getValueInternal(PropertyOrFieldReference.java:104)
at org.springframework.expression.spel.ast.PropertyOrFieldReference.access$000(PropertyOrFieldReference.java:51)
at org.springframework.expression.spel.ast.PropertyOrFieldReference$AccessorLValue.getValue(PropertyOrFieldReference.java:406)
at org.springframework.expression.spel.ast.CompoundExpression.getValueInternal(CompoundExpression.java:92)
at org.springframework.expression.spel.ast.SpelNodeImpl.getValue(SpelNodeImpl.java:112)
at org.springframework.expression.spel.standard.SpelExpression.getValue(SpelExpression.java:337)
at org.springframework.cloud.stream.binder.rabbit.RabbitExpressionEvaluatingInterceptor.preSend(RabbitExpressionEvaluatingInterceptor.java:92)
at org.springframework.integration.channel.AbstractMessageChannel$ChannelInterceptorList.preSend(AbstractMessageChannel.java:469)
at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:309)
... 35 more
See spring-attic/spring-cloud-stream-binder-rabbit#83 (comment)
With the functional model, the payload is converted before the channel interceptor (Rabbit Binder) can evaluate expressions against the payload.
Conversion needs to be deferred.