davsclaus commented on code in PR #23886: URL: https://github.com/apache/camel/pull/23886#discussion_r3380225941
########## 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: This filter uses `CAMEL_FILTER_STARTS_WITH` which blocks all headers starting with `Camel` / `camel`. Since every Dapr component header starts with `CamelDapr` (e.g., `CamelDaprID`, `CamelDaprSource`, `CamelDaprTopic`), this filter would block **all** of Dapr's own headers if it were actually applied in the consumer/producer. Compare with `KafkaHeaderFilterStrategy` — Kafka's component headers don't use the `Camel` prefix, so the generic filter works. For Dapr, you'd need to either: - Change Dapr's header naming to not use the `Camel` prefix, or - Override `applyFilterToExternalHeaders()` to allow `CamelDapr*` headers through ########## 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: These headers (`CamelDaprPubSubName` and `CamelDaprTopic`) were removed because the filter strategy would block them. But the consumer still sets `CamelDaprID`, `CamelDaprSource`, `CamelDaprType`, etc. — all of which would also be blocked by the same filter. The fix should be in the filter strategy (allow Dapr's own headers), not removing useful headers. Users consuming from Dapr PubSub need to know which pubsub and topic a message came from. -- 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]
