CAMEL-8190 has introduced behavior that has the potential to break existing code (hence setting to Critical priority so this can be fixed prior to 2.14.2/2.15.0 releases). It broke my code (using 2.14.2-SNAPSHOT builds) in development and staging, and I didn't notice the problem until tonight.
CAMEL-8190, the value of the KafkaConstants.PARTITION_KEY header was used for both the key and partitionKey of the kafka KeyedMessage. My downstream consumers depended on this for the correct key of the consumed message. CAMEL-8190, changed things so the key is set only via the KafkaConstants.KEY header, and since my code didn't set that header, the key started coming through as null to downstream consumers.
I propose the following to fix this (will attach a patch shortly):
- If both KEY and PARTITION_KEY are specified, no change from
- If just one is specified, call the KeyedMessage 3-argument constructor with the value (uses the value for both key and partitionKey)
- If neither are specified, pass null for both...but IMHO, a warning should be logged, as it seems unlikely that the user knowingly omitted both values.