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

Exclude all attributes starting with "goog_" from outbound Pub/Sub headers #776

Closed
elefeint opened this issue Dec 8, 2021 · 4 comments
Closed
Assignees
Labels

Comments

@elefeint
Copy link
Contributor

elefeint commented Dec 8, 2021

Report came from Gitter -- in a Spring Cloud Stream application, HeaderMapper fields are not customizable in the adapters. In a Processor SCS application, if the Pub/Sub message received from one subscription is passed as-is to a topic, the message will be rejected with:

com.google.api.gax.rpc.InvalidArgumentException: io.grpc.StatusRuntimeException: INVALID_ARGUMENT: The request contains an attribute key that is not valid (key=googclient_deliveryattempt). Attribute keys must be non-empty and must not begin with 'goog' (case-insensitive).

To prevent this issue, PubSubHeaderMapper.outboundHeaderPatterns needs to include "!goog_* by default.

@ddixit14
Copy link
Contributor

ddixit14 commented Dec 8, 2021

Sounds like something I can take up next? @elefeint

@elefeint
Copy link
Contributor Author

elefeint commented Dec 8, 2021

Yes, that's a good idea. First, reproduce the issue by creating a sample application that has a Spring Cloud Stream processor -- our current sample only has a source and a sink.

@elefeint
Copy link
Contributor Author

@ddixit14 Hints on reproducing using spring-cloud-gcp-pubsub-stream-functional-sample:

  • googclient_deliveryattempt only exists when the subscription has DLQ enabled. Can't reproduce otherwise.
  • In Spring Cloud Stream, to turn something from a Sink to a Processor, the functional bean needs to switch from being a Consumer (one input, no outputs) to being a Function (one input, one output).
  • Once you have a processor/function, tie the outgoing stream to a physical Pub/Sub topic with this property: spring.cloud.stream.bindings.logUserMessage-out-0.destination=my-topic2

Bonus question to think about: do we want to strip incoming goog* headers, outgoing ones, or both?

@ddixit14
Copy link
Contributor

Done hence closing the issue.

elefeint pushed a commit that referenced this issue Jan 28, 2022
kateryna216 added a commit to kateryna216/spring-cloud-gcp that referenced this issue Oct 20, 2022
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

2 participants