This is an automated email from the ASF dual-hosted git repository. jiriondrusek pushed a commit to branch camel-main in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git
commit 685fbb457a8afeeef2e07d3a997a5b4a81edd2c6 Author: Peter Palaga <[email protected]> AuthorDate: Mon Sep 8 08:57:56 2025 +0200 Conversion of component specific messages to jakarta.jms.Message is now supported by Camel --- .../messaging/it/MessagingCommonResource.java | 8 ++---- .../it/util/resolver/JmsMessageResolver.java | 24 ---------------- .../util/resolver/JmsMessageResolverProducer.java | 33 ---------------------- .../jms/util/JmsMessageResolverProducer.java | 29 ------------------- integration-tests-support/messaging/sjms/pom.xml | 4 --- .../quarkus/messaging/sjms/SjmsProducers.java | 3 +- .../sjms/util/JmsMessageResolverProducer.java | 29 ------------------- 7 files changed, 3 insertions(+), 127 deletions(-) diff --git a/integration-tests-support/messaging/common/src/main/java/org/apache/camel/quarkus/component/messaging/it/MessagingCommonResource.java b/integration-tests-support/messaging/common/src/main/java/org/apache/camel/quarkus/component/messaging/it/MessagingCommonResource.java index f9fe4499fb..c5b98babd5 100644 --- a/integration-tests-support/messaging/common/src/main/java/org/apache/camel/quarkus/component/messaging/it/MessagingCommonResource.java +++ b/integration-tests-support/messaging/common/src/main/java/org/apache/camel/quarkus/component/messaging/it/MessagingCommonResource.java @@ -49,7 +49,6 @@ import org.apache.camel.Exchange; import org.apache.camel.Message; import org.apache.camel.ProducerTemplate; import org.apache.camel.component.mock.MockEndpoint; -import org.apache.camel.quarkus.component.messaging.it.util.resolver.JmsMessageResolver; import org.apache.camel.quarkus.component.messaging.it.util.scheme.ComponentScheme; @Path("/messaging") @@ -64,9 +63,6 @@ public class MessagingCommonResource { @Inject CamelContext context; - @Inject - JmsMessageResolver messageResolver; - @Inject ComponentScheme componentScheme; @@ -128,7 +124,7 @@ public class MessagingCommonResource { mockEndpoint.assertIsSatisfied(5000); Exchange exchange = mockEndpoint.getReceivedExchanges().get(0); - jakarta.jms.Message message = messageResolver.resolve(exchange); + jakarta.jms.Message message = exchange.getMessage().getBody(jakarta.jms.Message.class); Object result; if ("string".equals(type) || "node".equals(type)) { @@ -162,7 +158,7 @@ public class MessagingCommonResource { mockEndpoint.assertIsSatisfied(5000); Exchange exchange = mockEndpoint.getReceivedExchanges().get(0); - MapMessage mapMessage = (MapMessage) messageResolver.resolve(exchange); + MapMessage mapMessage = (MapMessage) exchange.getMessage().getBody(jakarta.jms.Message.class); Map<String, String> result = new HashMap<>(); Enumeration<String> mapNames = mapMessage.getMapNames(); diff --git a/integration-tests-support/messaging/common/src/main/java/org/apache/camel/quarkus/component/messaging/it/util/resolver/JmsMessageResolver.java b/integration-tests-support/messaging/common/src/main/java/org/apache/camel/quarkus/component/messaging/it/util/resolver/JmsMessageResolver.java deleted file mode 100644 index 5148742c81..0000000000 --- a/integration-tests-support/messaging/common/src/main/java/org/apache/camel/quarkus/component/messaging/it/util/resolver/JmsMessageResolver.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * 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.quarkus.component.messaging.it.util.resolver; - -import jakarta.jms.Message; -import org.apache.camel.Exchange; - -public interface JmsMessageResolver { - Message resolve(Exchange exchange); -} diff --git a/integration-tests-support/messaging/common/src/main/java/org/apache/camel/quarkus/component/messaging/it/util/resolver/JmsMessageResolverProducer.java b/integration-tests-support/messaging/common/src/main/java/org/apache/camel/quarkus/component/messaging/it/util/resolver/JmsMessageResolverProducer.java deleted file mode 100644 index f0fe4be6f7..0000000000 --- a/integration-tests-support/messaging/common/src/main/java/org/apache/camel/quarkus/component/messaging/it/util/resolver/JmsMessageResolverProducer.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * 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.quarkus.component.messaging.it.util.resolver; - -import io.quarkus.arc.DefaultBean; -import jakarta.inject.Singleton; - -public class JmsMessageResolverProducer { - - @Singleton - @DefaultBean - public JmsMessageResolver jmsMessageResolver() { - // Default implementation to be overridden - return exchange -> { - throw new IllegalStateException( - "A valid implementation of JmsMessageResolver must be provided resolve jakarta.jms.Message from an exchange."); - }; - } -} diff --git a/integration-tests-support/messaging/jms/src/main/java/org/apache/camel/quarkus/messaging/jms/util/JmsMessageResolverProducer.java b/integration-tests-support/messaging/jms/src/main/java/org/apache/camel/quarkus/messaging/jms/util/JmsMessageResolverProducer.java deleted file mode 100644 index d240ee5a4e..0000000000 --- a/integration-tests-support/messaging/jms/src/main/java/org/apache/camel/quarkus/messaging/jms/util/JmsMessageResolverProducer.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * 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.quarkus.messaging.jms.util; - -import jakarta.inject.Singleton; -import org.apache.camel.component.jms.JmsMessage; -import org.apache.camel.quarkus.component.messaging.it.util.resolver.JmsMessageResolver; - -public class JmsMessageResolverProducer { - - @Singleton - public JmsMessageResolver messageResolver() { - return exchange -> exchange.getMessage(JmsMessage.class).getJmsMessage(); - } -} diff --git a/integration-tests-support/messaging/sjms/pom.xml b/integration-tests-support/messaging/sjms/pom.xml index 7a7686a820..737682daa2 100644 --- a/integration-tests-support/messaging/sjms/pom.xml +++ b/integration-tests-support/messaging/sjms/pom.xml @@ -39,10 +39,6 @@ <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-direct</artifactId> </dependency> - <dependency> - <groupId>org.apache.camel.quarkus</groupId> - <artifactId>camel-quarkus-sjms</artifactId> - </dependency> <dependency> <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-integration-tests-support-messaging-common</artifactId> diff --git a/integration-tests-support/messaging/sjms/src/main/java/org/apache/camel/quarkus/messaging/sjms/SjmsProducers.java b/integration-tests-support/messaging/sjms/src/main/java/org/apache/camel/quarkus/messaging/sjms/SjmsProducers.java index dca6537cc1..38fcd7914a 100644 --- a/integration-tests-support/messaging/sjms/src/main/java/org/apache/camel/quarkus/messaging/sjms/SjmsProducers.java +++ b/integration-tests-support/messaging/sjms/src/main/java/org/apache/camel/quarkus/messaging/sjms/SjmsProducers.java @@ -19,7 +19,6 @@ package org.apache.camel.quarkus.messaging.sjms; import io.quarkus.runtime.annotations.RegisterForReflection; import jakarta.inject.Named; import org.apache.camel.Exchange; -import org.apache.camel.component.sjms.SjmsConstants; public class SjmsProducers { @@ -34,7 +33,7 @@ public class SjmsProducers { public void setJmsDestinationHeader(Exchange exchange) { org.apache.camel.Message message = exchange.getMessage(); String destinationName = message.getHeader("DestinationName", String.class); - message.setHeader(SjmsConstants.JMS_DESTINATION_NAME, destinationName); + message.setHeader("CamelJMSDestinationName", destinationName); } } } diff --git a/integration-tests-support/messaging/sjms/src/main/java/org/apache/camel/quarkus/messaging/sjms/util/JmsMessageResolverProducer.java b/integration-tests-support/messaging/sjms/src/main/java/org/apache/camel/quarkus/messaging/sjms/util/JmsMessageResolverProducer.java deleted file mode 100644 index c49dd86c2c..0000000000 --- a/integration-tests-support/messaging/sjms/src/main/java/org/apache/camel/quarkus/messaging/sjms/util/JmsMessageResolverProducer.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * 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.quarkus.messaging.sjms.util; - -import jakarta.inject.Singleton; -import org.apache.camel.component.sjms.SjmsMessage; -import org.apache.camel.quarkus.component.messaging.it.util.resolver.JmsMessageResolver; - -public class JmsMessageResolverProducer { - - @Singleton - public JmsMessageResolver messageResolver() { - return exchange -> exchange.getMessage(SjmsMessage.class).getJmsMessage(); - } -}
