In Cloud Stream "2021.0.4", we are facing issue: Routing to destination is failing when Partitioning is enabled for the RabbitMQ. Binder always throwing "Partition key can't be null". This does not occur when we rollback to 2021.0.3. Please note that this feature we are using in the existing app and working fine till now.
We are using the following expression: spring.cloud.stream.bindings.output.producer.partition-key-expression: headers['amqp_correlationId'] tried with other varitions like headers['correlation_id'], headers.correlation_id but not working.
Looking for a fix in 2021.0.4
private Object extractKey(Message<?> message) {
Object key = invokeKeyExtractor(message);
if (key == null && this.producerProperties.getPartitionKeyExpression() != null) {
key = this.producerProperties.getPartitionKeyExpression()
.getValue(this.evaluationContext, message);
}
**Assert.notNull(key, "Partition key cannot be null");**
return key;
}