[ 
https://issues.apache.org/jira/browse/CAMEL-22658?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Dave Riseley updated CAMEL-22658:
---------------------------------
    Description: 
Since the change for CAMEL-22403 was applied, we have had issues where the 
Camel PubSub producer fails to send messages to a Google Pub Sub topic.

The scenario is:

1. PubSub message received by the consumer
2. Processing occurs
3. Attempt to send response message to a different topic.

The exception seen is:

{code}
java.util.concurrent.ExecutionException: 
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).
        at 
com.google.common.util.concurrent.AbstractFuture.getDoneValue(AbstractFuture.java:292)
        at 
com.google.common.util.concurrent.AbstractFutureState.blockingGet(AbstractFutureState.java:255)
        at com.google.common.util.concurrent.Platform.get(Platform.java:54)
        at 
com.google.common.util.concurrent.AbstractFuture.get(AbstractFuture.java:253)
        at com.google.api.core.AbstractApiFuture.get(AbstractApiFuture.java:53)
        at 
org.apache.camel.component.google.pubsub.GooglePubsubProducer.send(GooglePubsubProducer.java:138)
        at 
org.apache.camel.component.google.pubsub.GooglePubsubProducer.process(GooglePubsubProducer.java:84)
        at 
org.apache.camel.support.AsyncProcessorConverterHelper$ProcessorToAsyncProcessorBridge.process(AsyncProcessorConverterHelper.java:65)
        at 
org.apache.camel.processor.SendProcessor.sendUsingProducer(SendProcessor.java:251)
        at 
org.apache.camel.processor.SendProcessor.process(SendProcessor.java:156)
        at 
org.apache.camel.processor.errorhandler.RedeliveryErrorHandler$RedeliveryTask.doRun(RedeliveryErrorHandler.java:777)
        at 
org.apache.camel.processor.errorhandler.RedeliveryErrorHandler$RedeliveryTask.run(RedeliveryErrorHandler.java:720)
        at 
org.apache.camel.impl.engine.DefaultReactiveExecutor$Worker.doRun(DefaultReactiveExecutor.java:199)
...
{code}

I believe the issue is in the new GooglePubsubHeaderFilterStrategy class: 
https://github.com/apache/camel/blob/camel-4.14.x/components/camel-google/camel-google-pubsub/src/main/java/org/apache/camel/component/google/pubsub/GooglePubsubHeaderFilterStrategy.java

This filters only headers starting with {{x-goog}} or {{X-GOOG}} and not 
{{goog}}.  The legacy code is still there to filter those headers:

https://github.com/apache/camel/blob/811f38029a858fa5e35ae6f9979c614b19600f00/components/camel-google/camel-google-pubsub/src/main/java/org/apache/camel/component/google/pubsub/GooglePubsubProducer.java#L113

but then when the header filter is applied - it allows the `goog` headers back 
in again

We cannot configure the HeaderFilterStrategy on the GooglePubsubProducer, so 
can't override this behaviour


  was:
Since the change for CAMEL-22403 was applied, we have had issues where the 
Camel PubSub producer fails to send messages to a Google Pub Sub topic.

The scenario is:

1. PubSub message received by the consumer
2. Processing occurs
3. Attempt to send response message to a different topic.

The exception seen is:

{code}
java.util.concurrent.ExecutionException: 
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).
        at 
com.google.common.util.concurrent.AbstractFuture.getDoneValue(AbstractFuture.java:292)
        at 
com.google.common.util.concurrent.AbstractFutureState.blockingGet(AbstractFutureState.java:255)
        at com.google.common.util.concurrent.Platform.get(Platform.java:54)
        at 
com.google.common.util.concurrent.AbstractFuture.get(AbstractFuture.java:253)
        at com.google.api.core.AbstractApiFuture.get(AbstractApiFuture.java:53)
        at 
org.apache.camel.component.google.pubsub.GooglePubsubProducer.send(GooglePubsubProducer.java:138)
        at 
org.apache.camel.component.google.pubsub.GooglePubsubProducer.process(GooglePubsubProducer.java:84)
        at 
org.apache.camel.support.AsyncProcessorConverterHelper$ProcessorToAsyncProcessorBridge.process(AsyncProcessorConverterHelper.java:65)
        at 
org.apache.camel.processor.SendProcessor.sendUsingProducer(SendProcessor.java:251)
        at 
org.apache.camel.processor.SendProcessor.process(SendProcessor.java:156)
        at 
org.apache.camel.processor.errorhandler.RedeliveryErrorHandler$RedeliveryTask.doRun(RedeliveryErrorHandler.java:777)
        at 
org.apache.camel.processor.errorhandler.RedeliveryErrorHandler$RedeliveryTask.run(RedeliveryErrorHandler.java:720)
        at 
org.apache.camel.impl.engine.DefaultReactiveExecutor$Worker.doRun(DefaultReactiveExecutor.java:199)
...
{code}

I believe the issue is in the new GooglePubsubHeaderFilterStrategy class: 
https://github.com/apache/camel/blob/camel-4.14.x/components/camel-google/camel-google-pubsub/src/main/java/org/apache/camel/component/google/pubsub/GooglePubsubHeaderFilterStrategy.java

This filters only headers starting with x-goog or X-GOOG and not `goog`.  The 
legacy code is still there to filter those headers:

https://github.com/apache/camel/blob/811f38029a858fa5e35ae6f9979c614b19600f00/components/camel-google/camel-google-pubsub/src/main/java/org/apache/camel/component/google/pubsub/GooglePubsubProducer.java#L113

but then when the header filter is applied - it allows the `goog` headers back 
in again



> [camel-google-pubsub] GooglePubsubProducer fails with INVALID_ARGUMENT
> ----------------------------------------------------------------------
>
>                 Key: CAMEL-22658
>                 URL: https://issues.apache.org/jira/browse/CAMEL-22658
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-google-pubsub
>    Affects Versions: 4.14.2
>            Reporter: Dave Riseley
>            Priority: Minor
>
> Since the change for CAMEL-22403 was applied, we have had issues where the 
> Camel PubSub producer fails to send messages to a Google Pub Sub topic.
> The scenario is:
> 1. PubSub message received by the consumer
> 2. Processing occurs
> 3. Attempt to send response message to a different topic.
> The exception seen is:
> {code}
> java.util.concurrent.ExecutionException: 
> 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).
>       at 
> com.google.common.util.concurrent.AbstractFuture.getDoneValue(AbstractFuture.java:292)
>       at 
> com.google.common.util.concurrent.AbstractFutureState.blockingGet(AbstractFutureState.java:255)
>       at com.google.common.util.concurrent.Platform.get(Platform.java:54)
>       at 
> com.google.common.util.concurrent.AbstractFuture.get(AbstractFuture.java:253)
>       at com.google.api.core.AbstractApiFuture.get(AbstractApiFuture.java:53)
>       at 
> org.apache.camel.component.google.pubsub.GooglePubsubProducer.send(GooglePubsubProducer.java:138)
>       at 
> org.apache.camel.component.google.pubsub.GooglePubsubProducer.process(GooglePubsubProducer.java:84)
>       at 
> org.apache.camel.support.AsyncProcessorConverterHelper$ProcessorToAsyncProcessorBridge.process(AsyncProcessorConverterHelper.java:65)
>       at 
> org.apache.camel.processor.SendProcessor.sendUsingProducer(SendProcessor.java:251)
>       at 
> org.apache.camel.processor.SendProcessor.process(SendProcessor.java:156)
>       at 
> org.apache.camel.processor.errorhandler.RedeliveryErrorHandler$RedeliveryTask.doRun(RedeliveryErrorHandler.java:777)
>       at 
> org.apache.camel.processor.errorhandler.RedeliveryErrorHandler$RedeliveryTask.run(RedeliveryErrorHandler.java:720)
>       at 
> org.apache.camel.impl.engine.DefaultReactiveExecutor$Worker.doRun(DefaultReactiveExecutor.java:199)
> ...
> {code}
> I believe the issue is in the new GooglePubsubHeaderFilterStrategy class: 
> https://github.com/apache/camel/blob/camel-4.14.x/components/camel-google/camel-google-pubsub/src/main/java/org/apache/camel/component/google/pubsub/GooglePubsubHeaderFilterStrategy.java
> This filters only headers starting with {{x-goog}} or {{X-GOOG}} and not 
> {{goog}}.  The legacy code is still there to filter those headers:
> https://github.com/apache/camel/blob/811f38029a858fa5e35ae6f9979c614b19600f00/components/camel-google/camel-google-pubsub/src/main/java/org/apache/camel/component/google/pubsub/GooglePubsubProducer.java#L113
> but then when the header filter is applied - it allows the `goog` headers 
> back in again
> We cannot configure the HeaderFilterStrategy on the GooglePubsubProducer, so 
> can't override this behaviour



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to