Conversation
Restore reading the target-protocol header when choosing Cloud Event attribute prefixes so cross-binder flows (e.g. AMQP to Kafka) can use ce_ without requiring kafka_* headers on the message. Fixes spring-cloudgh-1461 Signed-off-by: arimu1 <19286898+arimu1@users.noreply.github.com>
|
I’m confused, this fix would require users to set the |
|
@olegz this does not solve #1461, it’s only a workaround that allows setting Could you thus reopen #1461? p.s. for some reason, I’m no longer able to run the test in
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
MessageUtils.TARGET_PROTOCOLand resolves thetarget-protocolheader (case-insensitive) before inferring protocol fromkafka_*/amqpheaders inCloudEventMessageUtils.extractTargetProtocol.CloudEventsFunctionInvocationHelper.postProcessResultwhen choosing the output Cloud Event attribute prefix.target-protocol: kafka(cross-binder scenario from ce_ prefix is no longer applied automatically for Cloud Events sent to Kafka #1461).Fixes gh-1461
Context
Since gh-1294 / spring-cloud/spring-cloud-stream#2222, Spring Cloud Stream no longer sets
target-protocolon messages, and prefix detection falls back to binder-specific headers on the input message. For AMQP → Kafka flows (e.g.function-sample-cloudevent-stream), that yieldscloudEvents:on Kafka instead ofce_.This change restores the function-side support for
target-protocol. Spring Cloud Stream should restore setting that header on function input (see commented lines inFunctionConfiguration.FunctionWrapper#setHeadersIfNeededand the reactivetargetProtocolEnhancer) so end-to-end behavior matches the sample README again.Test plan
./mvnw -pl spring-cloud-function-context -am test./mvnw -f spring-cloud-function-samples/function-sample-cloudevent-stream/pom.xml test(module not in parent reactor; requires Rabbit/Kafka on localhost;DemoApplicationTests#testis currently commented out)DemoApplicationTests#testand verify Kafka headers usece_prefix