oscerd commented on code in PR #23886:
URL: https://github.com/apache/camel/pull/23886#discussion_r3380336724


##########
components/camel-dapr/src/main/java/org/apache/camel/component/dapr/DaprHeaderFilterStrategy.java:
##########
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.dapr;
+
+import org.apache.camel.support.DefaultHeaderFilterStrategy;
+
+/**
+ * Default header filter strategy for Dapr endpoints.
+ */
+public class DaprHeaderFilterStrategy extends DefaultHeaderFilterStrategy {
+
+    public DaprHeaderFilterStrategy() {
+        setLowerCase(true);
+        setOutFilterStartsWith(CAMEL_FILTER_STARTS_WITH);
+        setInFilterStartsWith(CAMEL_FILTER_STARTS_WITH);
+    }

Review Comment:
   > :robot: _Claude Code on behalf of Andrea Cosentino_
   
   Right — and that's why CAMEL-23630 stops copying the two routing headers 
(option b) rather than applying the filter per-header (option a). This mirrors 
`IggyHeaderFilterStrategy` and is exposed for consistency + the standard 
`headerFilterStrategy` option. It's never run over the component's own 
`CamelDapr*` metadata (those are set directly), so it won't strip them. A 
`Camel*` filter would only act on an arbitrary sender-controlled header map — 
which the Dapr `CloudEvent<T>` POJO doesn't have (no extension attributes), so 
there's nothing external to filter in the consumer. Overriding 
`applyFilterToExternalHeaders()` to allow `CamelDapr*` through isn't needed, 
since we never pass those (or any external map) through the filter.
   



##########
components/camel-dapr/src/main/java/org/apache/camel/component/dapr/consumer/DaprPubSubConsumer.java:
##########
@@ -102,8 +102,6 @@ private Exchange createServiceBusExchange(final 
CloudEvent<byte[]> cloudEvent) {
         message.setBody(cloudEvent.getData());
 
         // set headers
-        message.setHeader(DaprConstants.PUBSUB_NAME, 
cloudEvent.getPubsubName());
-        message.setHeader(DaprConstants.TOPIC, cloudEvent.getTopic());
         message.setHeader(DaprConstants.ID, cloudEvent.getId());

Review Comment:
   > :robot: _Claude Code on behalf of Andrea Cosentino_
   
   The asymmetry is intentional. `CamelDaprPubSubName`/`CamelDaprTopic` are 
read back on the **producer** side by 
`DaprConfigurationOptionsProxy#getPubSubName/getTopic` (header preferred over 
endpoint config, consumed by `DaprPubSubHandler`), so carrying them out of a 
consumer makes `from(dapr-pubsub).to(dapr-pubsub)` override the configured 
destination — the exact carry-over CAMEL-23630 targets. 
`CamelDaprID/Source/Type/...` are never read on the producer side, so they're 
harmless and stay. On knowing the source pubsub/topic: a `dapr-pubsub` consumer 
subscribes to a single fixed `pubSubName:topic`, so the value always equals the 
endpoint URI you configured — the header was redundant for the consumer. Added 
a 4.21 upgrade-guide note documenting the removal.
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to