You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by "lopushen (via GitHub)" <gi...@apache.org> on 2024/05/03 11:23:55 UTC

[PR] Ref#271: Add missing bundles for camel-amqp and camel-activemq [camel-karaf]

lopushen opened a new pull request, #272:
URL: https://github.com/apache/camel-karaf/pull/272

   Fixes https://github.com/apache/camel-karaf/issues/271
   
   ### Motivation
   During testing using an OSGI blueprint, it turned out that the camel-amqp and camel-activemq are missing bundles to successfully execute the route. Since these two features both and the only ones that depend upon camel-jms, and the micrometer dependency should be added to camel-jms, the fixes for both features are united in a single PR.
   
   ### Modifications:
   Add a workaround for spring-jms SMX bundle to contain micrometer until https://issues.apache.org/jira/browse/SM-5706 is resolved and released
   Add missing bundles for both features to run
   
   **camel-amqp** was tested with
   ```
   <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
              xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
              xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0"
              xsi:schemaLocation="
                http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0 http://aries.apache.org/schemas/blueprint-cm/blueprint-cm-1.1.0.xsd
                http://www.osgi.org/xmlns/blueprint/v1.0.0 https://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd
                http://camel.apache.org/schema/blueprint http://camel.apache.org/schema/blueprint/camel-blueprint.xsd">
   
       <bean id="amqpConnectionDetails" class="org.apache.camel.component.amqp.AMQPConnectionDetails">
           <argument value="amqp://localhost:5672"/>
       </bean>
   
   
       <camelContext id="camelContext" xmlns="http://camel.apache.org/schema/blueprint">
           <route id="amqpRoute">
               <from uri="timer://testTimer?fixedRate=true&amp;period=5000"/>
               <setHeader name="theHeader">
                   <constant>This is header</constant>
               </setHeader>
               <setBody>
                   <constant>Hello Camel</constant>
               </setBody>
               <to uri="amqp:amqpQueueName"/>
               <log message="Message sent to AMQP: ${body} headers ${header.theHeader}"/>
           </route>
   
           <route id="amqpRoute2">
               <from uri="amqp:amqpQueueName"/>
               <log message="Message received from AMQP: ${body} headers ${header.theHeader}"/>
               <choice>
                   <when>
                       <simple>${header.theHeader} != "This is header"</simple>
                       <log message="KO - not expected ${header.theHeader}"/>
                       <throwException exceptionType="java.lang.Exception" message="An unexpected header returned"/>
                   </when>
                   <otherwise>
                       <log message="OK - expected ${header.theHeader}"/>
                       
                   </otherwise>
               </choice>
               <choice>
                   <when>
                       <simple>${body} != "Hello Camel"</simple>
                       <log message="KO - not expected ${body}"/>
                       <throwException exceptionType="java.lang.Exception" message="An unexpected body returned"/>
                   </when>
                   <otherwise>
                       <log message="OK - expected ${body}"/>
                   </otherwise>
               </choice>
           </route>
   
       </camelContext>
   
   </blueprint>
   ```
   
   **camel-activemq** was tested with
   ```
   <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
              xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
              xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0"
              xsi:schemaLocation="
                http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0 http://aries.apache.org/schemas/blueprint-cm/blueprint-cm-1.1.0.xsd
                http://www.osgi.org/xmlns/blueprint/v1.0.0 https://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd
                http://camel.apache.org/schema/blueprint http://camel.apache.org/schema/blueprint/camel-blueprint.xsd">
   
   
       <bean id="activemqConfig" class="org.apache.camel.component.activemq.ActiveMQConfiguration">
           <property name="connectionFactory" ref="activemqConnectionFactory"/>
       </bean>
   
        <bean id="activemqConnectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory">
           <argument value="tcp://localhost:61616"/>
           <property name="watchTopicAdvisories" value="false"/>
                   <property name="userName" value="myUser"/>
           <property name="password" value="myPassword"/> 
       </bean>
   
       <bean id="activemq" class="org.apache.camel.component.activemq.ActiveMQComponent">
           <property name="configuration" ref="activemqConfig"/>
       </bean>
   
       <camelContext id="camel" xmlns="http://camel.apache.org/schema/blueprint">
           <route id="activeMqProducerRoute">
               <from uri="timer://myTimer?fixedRate=true&amp;period=5000"/>
               <setBody>
                   <simple>Hello Camel</simple>
               </setBody>
               <log message="Sending message to ActiveMQ: ${body}"/>
               <to uri="activemq:queue:activemqQueueName"/>
               <log message="Message sent to ActiveMQ: ${body}"/>
           </route>
           <route id="activeMqConsumerRoute">
           <from uri="activemq:queue:activemqQueueName"/>
           <log message="Message received from ActiveMQ: ${body}"/>
           </route>
       </camelContext>
   
   </blueprint>
   ```


-- 
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: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Ref#271: Add missing bundles for camel-amqp and camel-activemq [camel-karaf]

Posted by "jbonofre (via GitHub)" <gi...@apache.org>.
jbonofre merged PR #272:
URL: https://github.com/apache/camel-karaf/pull/272


-- 
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: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Ref#271: Add missing bundles for camel-amqp and camel-activemq [camel-karaf]

Posted by "stataru8 (via GitHub)" <gi...@apache.org>.
stataru8 commented on PR #272:
URL: https://github.com/apache/camel-karaf/pull/272#issuecomment-2115829028

   Manual tests against commit (fb63411a6596816ad6ea234e5d94440bff5dc375) work on my end for both components, camel-activemq and camel-amqp 👍
   
   **[camel-amqp]**
   Command to enable the amqp plugin:
   `docker exec -it <containerId> rabbitmq-plugins enable rabbitmq_amqp1_0`


-- 
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: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Ref#271: Add missing bundles for camel-amqp and camel-activemq [camel-karaf]

Posted by "jbonofre (via GitHub)" <gi...@apache.org>.
jbonofre commented on code in PR #272:
URL: https://github.com/apache/camel-karaf/pull/272#discussion_r1589160323


##########
features/src/main/feature/camel-features.xml:
##########
@@ -285,11 +285,18 @@
 
     <feature name='camel-activemq' version='${project.version}' start-level='50'>
         <feature version='${camel.osgi.version.range}'>camel-jms</feature>
+        <bundle dependency='true'>mvn:org.apache.activemq/activemq-client-jakarta/${activemq-version}</bundle>
+        <bundle dependency='true'>mvn:org.fusesource.hawtbuf/hawtbuf/1.11</bundle>

Review Comment:
   Oh, you are right, it's used by the marshaller. 



-- 
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: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Ref#271: Add missing bundles for camel-amqp and camel-activemq [camel-karaf]

Posted by "lopushen (via GitHub)" <gi...@apache.org>.
lopushen commented on code in PR #272:
URL: https://github.com/apache/camel-karaf/pull/272#discussion_r1589137744


##########
features/src/main/feature/camel-features.xml:
##########
@@ -285,11 +285,18 @@
 
     <feature name='camel-activemq' version='${project.version}' start-level='50'>
         <feature version='${camel.osgi.version.range}'>camel-jms</feature>
+        <bundle dependency='true'>mvn:org.apache.activemq/activemq-client-jakarta/${activemq-version}</bundle>
+        <bundle dependency='true'>mvn:org.fusesource.hawtbuf/hawtbuf/1.11</bundle>

Review Comment:
   With the proposed change I'm getting the following error
   ```
   15:29:07.147 DEBUG [ActiveMQ Transport: tcp://localhost/127.0.0.1:61616@50075] Async exception with no exception listener: java.io.IOException: Unexpected error occurred: java.lang.NoClassDefFoundError: org/fusesource/hawtbuf/UTF8Buffer
   java.io.IOException: Unexpected error occurred: java.lang.NoClassDefFoundError: org/fusesource/hawtbuf/UTF8Buffer
   	at org.apache.activemq.transport.tcp.TcpTransport.run(TcpTransport.java:222) [!/:5.18.3]
   	at java.lang.Thread.run(Thread.java:833) [?:?]
   Caused by: java.lang.NoClassDefFoundError: org/fusesource/hawtbuf/UTF8Buffer
   	at org.apache.activemq.util.MarshallingSupport.readUTF(MarshallingSupport.java:229) ~[!/:5.18.3]
   	at org.apache.activemq.util.MarshallingSupport.unmarshalPrimitive(MarshallingSupport.java:200) ~[!/:5.18.3]
   	at org.apache.activemq.util.MarshallingSupport.unmarshalPrimitiveMap(MarshallingSupport.java:98) ~[!/:5.18.3]
   	at org.apache.activemq.util.MarshallingSupport.unmarshalPrimitiveMap(MarshallingSupport.java:78) ~[!/:5.18.3]
   	at org.apache.activemq.command.WireFormatInfo.unmarsallProperties(WireFormatInfo.java:177) ~[!/:5.18.3]
   	at org.apache.activemq.command.WireFormatInfo.getProperties(WireFormatInfo.java:150) ~[!/:5.18.3]
   	at org.apache.activemq.command.WireFormatInfo.toString(WireFormatInfo.java:374) ~[!/:5.18.3]
   	at java.lang.StringConcatHelper.stringOf(StringConcatHelper.java:453) ~[?:?]
   	at org.apache.activemq.transport.InactivityMonitor.configuredOk(InactivityMonitor.java:103) ~[!/:5.18.3]
   	at org.apache.activemq.transport.AbstractInactivityMonitor.startMonitorThreads(AbstractInactivityMonitor.java:449) ~[!/:5.18.3]
   	at org.apache.activemq.transport.InactivityMonitor.startMonitorThreads(InactivityMonitor.java:88) ~[!/:5.18.3]
   	at org.apache.activemq.transport.InactivityMonitor.processInboundWireFormatInfo(InactivityMonitor.java:61) ~[!/:5.18.3]
   	at org.apache.activemq.transport.AbstractInactivityMonitor.onCommand(AbstractInactivityMonitor.java:295) [!/:5.18.3]
   	at org.apache.activemq.transport.TransportSupport.doConsume(TransportSupport.java:83) [!/:5.18.3]
   	at org.apache.activemq.transport.tcp.TcpTransport.doRun(TcpTransport.java:233) ~[!/:5.18.3]
   	at org.apache.activemq.transport.tcp.TcpTransport.run(TcpTransport.java:215) ~[!/:5.18.3]
   	... 1 more
   
   ```
   I suppose we still need hawtbuf



-- 
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: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Ref#271: Add missing bundles for camel-amqp and camel-activemq [camel-karaf]

Posted by "jbonofre (via GitHub)" <gi...@apache.org>.
jbonofre commented on code in PR #272:
URL: https://github.com/apache/camel-karaf/pull/272#discussion_r1589098637


##########
features/src/main/feature/camel-features.xml:
##########
@@ -285,11 +285,18 @@
 
     <feature name='camel-activemq' version='${project.version}' start-level='50'>
         <feature version='${camel.osgi.version.range}'>camel-jms</feature>
+        <bundle dependency='true'>mvn:org.apache.activemq/activemq-client-jakarta/${activemq-version}</bundle>

Review Comment:
   NB: when upgrading to ActiveMQ 6.x, we will be able to use `activemq-client` (`activemq-client-jakarta` is just for transition on 5.18.x).



##########
features/src/main/feature/camel-features.xml:
##########
@@ -285,11 +285,18 @@
 
     <feature name='camel-activemq' version='${project.version}' start-level='50'>
         <feature version='${camel.osgi.version.range}'>camel-jms</feature>
+        <bundle dependency='true'>mvn:org.apache.activemq/activemq-client-jakarta/${activemq-version}</bundle>
+        <bundle dependency='true'>mvn:org.fusesource.hawtbuf/hawtbuf/1.11</bundle>

Review Comment:
   This one should be optional in the import. I would remove it and define optional in the wrapper.



##########
features/src/main/feature/camel-features.xml:
##########
@@ -1237,6 +1244,16 @@
     <feature name="camel-jms" version="${project.version}" start-level="50">
         <feature version='${camel.osgi.version.range}'>camel-core</feature>
         <feature version="${camel.osgi.spring.version}">spring-jms</feature>
+        <!-- The SMX bundle of Spring JMS doesn't contain micrometer as part of its import packages, see https://issues.apache.org/jira/browse/SM-5706,
+            so we need to override the imports by wrapping the bundle until it is fixed in the SMX bundle project and in Karaf.
+            The Bundle-Version is updated by Bundle-Version=${spring-version}.2 so that the updated bundle is used
+            instead of the one provided by Karaf.
+        -->
+        <!-- Workaround START -->
+        <bundle start-level="30">wrap:mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.spring-jms/${spring-version}_1$overwrite=merge&amp;Import-package=io.micrometer;resolution:=optional,*;resolution:=optional&amp;Bundle-Version=${spring-version}.2</bundle>

Review Comment:
   That will be fix in the next SMX bundles releases (I will prepare the release during the week end).



-- 
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: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org