Camel Zookeeper Component not found in activeMQs embedded Camel Modul - apache-camel

On 3 virtual machines running Zookeeper + ActiveMQ.
ActiveMQ Version 5.15.9 with Camel Version 2.19.5
Now, I'm using the embedded Camel EIP Framework in ActiveMQ.
I want to get a specific node from Zookeeper based on an event.
<camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
<!-- You can use Spring XML syntax to define the routes here using the <route> element -->
<route>
<description>Read zookeeper variant 1</description>
<from uri="activemq:example.zoo1"/>
<pollEnrich>
<constant>zookeeper://localhost:2182/some/node/99</constant>
</pollEnrich>
<to uri="activemq:example.zooRead1"/>
</route>
<route>
<description>Read zookeeper variant 2</description>
<from uri="activemq:example.zoo2"/>
<pollEnrich>
<constant>zookeeper:znode1:2182,znode2:2182,znode3:2182/some/node/99</constant>
</pollEnrich>
<to uri="activemq:example.zooRead2"/>
</route>
</camelContext>
In the Log File following exception occured with variant 1
org.apache.camel.ResolveEndpointFailedException: Failed to resolve endpoint: zookeeper://localhost:2182/some/node/99 due to: No component found with scheme: zookeeper
at org.apache.camel.impl.DefaultCamelContext.getEndpoint(DefaultCamelContext.java:729)[camel-core-2.19.5.jar:2.19.5]
at org.apache.camel.util.CamelContextHelper.getMandatoryEndpoint(CamelContextHelper.java:80)[camel-core-2.19.5.jar:2.19.5]
at org.apache.camel.util.ExchangeHelper.resolveEndpoint(ExchangeHelper.java:92)[camel-core-2.19.5.jar:2.19.5]
at org.apache.camel.processor.PollEnricher.resolveEndpoint(PollEnricher.java:343)[camel-core-2.19.5.jar:2.19.5]
at org.apache.camel.processor.PollEnricher.process(PollEnricher.java:201)[camel-core-2.19.5.jar:2.19.5]
at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:77)[camel-core-2.19.5.jar:2.19.5]
at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:541)[camel-core-2.19.5.jar:2.19.5]
at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:198)[camel-core-2.19.5.jar:2.19.5]
at org.apache.camel.processor.Pipeline.process(Pipeline.java:120)[camel-core-2.19.5.jar:2.19.5]
at org.apache.camel.processor.Pipeline.process(Pipeline.java:83)[camel-core-2.19.5.jar:2.19.5]
at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:198)[camel-core-2.19.5.jar:2.19.5]
at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:97)[camel-core-2.19.5.jar:2.19.5]
at org.apache.camel.component.jms.EndpointMessageListener.onMessage(EndpointMessageListener.java:112)[camel-jms-2.19.5.jar:2.19.5]
at org.springframework.jms.listener.AbstractMessageListenerContainer.doInvokeListener(AbstractMessageListenerContainer.java:719)[spring-jms-4.3.18.RELEASE.jar:4.3.18.RELEASE]
at org.springframework.jms.listener.AbstractMessageListenerContainer.invokeListener(AbstractMessageListenerContainer.java:679)[spring-jms-4.3.18.RELEASE.jar:4.3.18.RELEASE]
at org.springframework.jms.listener.AbstractMessageListenerContainer.doExecuteListener(AbstractMessageListenerContainer.java:649)[spring-jms-4.3.18.RELEASE.jar:4.3.18.RELEASE]
at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.doReceiveAndExecute(AbstractPollingMessageListenerContainer.java:317)[spring-jms-4.3.18.RELEASE.jar:4.3.18.RELEASE]
at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveAndExecute(AbstractPollingMessageListenerContainer.java:255)[spring-jms-4.3.18.RELEASE.jar:4.3.18.RELEASE]
at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener(DefaultMessageListenerContainer.java:1168)[spring-jms-4.3.18.RELEASE.jar:4.3.18.RELEASE]
at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.executeOngoingLoop(DefaultMessageListenerContainer.java:1160)[spring-jms-4.3.18.RELEASE.jar:4.3.18.RELEASE]
at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:1057)[spring-jms-4.3.18.RELEASE.jar:4.3.18.RELEASE]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)[:1.8.0_222]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)[:1.8.0_222]
at java.lang.Thread.run(Thread.java:748)[:1.8.0_222]
2019-10-01 15:06:05,652 | DEBUG | Message exchange has failed: so breaking out of pipeline for exchange: Exchange[ID-Monkey-34387-1569942241018-0-1] Exception: org.apache.camel.ResolveEndpointFailedException: Failed to resolve endpoint: zookeeper://localhost:2182/some/node/99 due to: No component found with scheme: zookeeper | org.apache.camel.processor.Pipeline | Camel (camel) thread #1 - JmsConsumer[example.zoo1]
2019-10-01 15:06:05,690 | WARN | Execution of JMS message listener failed. Caused by: [org.apache.camel.ResolveEndpointFailedException - Failed to resolve endpoint: zookeeper://localhost:2182/some/node/99 due to: No component found with scheme: zookeeper] | org.apache.camel.component.jms.EndpointMessageListener | Camel (camel) thread #1 - JmsConsumer[example.zoo1]
org.apache.camel.ResolveEndpointFailedException: Failed to resolve endpoint: zookeeper://localhost:2182/some/node/99 due to: No component found with scheme: zookeeper
Camel Zookeeper Component

The solution works as #Bedla wrote.
Copy the Jar in the ACTIVEMQ_HOME/lib folder and it works as expceted.

Related

Create route in Apache ServiceMix Bundle:List state is Grace Period

I create a route on apache servicemix and put it in deploy. When the server started and I check the bundle:list it says that my route is in Grace Period and it's not working.
Currently I'm routing ftp to file server and do this format.
<camelContext xmlns="http://camel.apache.org/schema/blueprint">
<route>
<from uri="FTP:username#//hostname /DB?password=password"/>
<to uri="file:\\storage\folder\anotherFolder\anotherFolder\anotherFolder\"/>
</route>
</camelContext>
I did not input the exact credentials I use but that is the format that I used.
Is there any problem with my code or it's on my apache service mix? Please help I doing this for a week.
P.S. It works when its file to file server
You can install ftp using feature:install camel-ftp .

Camel Quartz with Route Policy

I am facing the issue where quartz doesn't start up. Is there anything wrong with my below config?
I have also requirement where i have to suspend the job at specific time and resume it again.
I have configured the policy using quartz as described in the link
https://camel.apache.org/manual/latest/cronscheduledroutepolicy.html
Any help or suggestions please?
<camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
<route routePolicyRef="testRoutePolicy">
<from uri="Reading from queue"/> // exact names are hidden due to security reasons
<transacted/>
<setHeader headerName="id">
<simple>${in.header.id}</simple>
</setHeader>
<to uri="bean:beanName1"/> // exact names are hidden due to security reasons
<log message="Got response: ${body}"/>
<to uri="Sending to another queue"/> // exact names are hidden due to security reasons
</route>
<route routePolicyRef="testRoutePolicy">
<from uri="Reading from queue"/>
<transacted/>
<setHeader headerName="id">
<simple>${in.header.id}</simple>
</setHeader>
<to uri="bean:beanName2"/>
<log message="Got response: ${body}"/>
<to uri="bean:beanName3"/>
</route>
<route routePolicyRef="testRoutePolicy">
<from uri="Reading from queue"/>
<transacted/>
<to uri="bean:beanName4"/>
<to uri="Sending to another queue"/>
</route>
</camelContext>
<bean id="testRoutePolicy" class="org.apache.camel.routepolicy.quartz.CronScheduledRoutePolicy">
<property name="routeStartTime" value="* * * * *"/>
<property name="routeSuspendTime" value="0 30 5 ? * SUN *"/>
<property name="routeResumeTime" value="0 0 8 ? * SUN *"/>
</bean>
Jboss Logs:
29/01/20 14:13:38,701 INFO [C3P0Registry] Initializing c3p0-0.9.5.2 [built 08-December-2015 22:06:04 -0800; debug? true; trace: 10] [main]
29/01/20 14:13:38,818 INFO [SpringCamelContext] Apache Camel 2.19.1 (CamelContext: camel) is starting [main]
29/01/20 14:13:38,820 INFO [ManagedManagementStrategy] JMX is enabled [main]
29/01/20 14:13:38,965 INFO [DefaultTypeConverter] Loaded 196 type converters [main]
29/01/20 14:13:39,018 INFO [DefaultRuntimeEndpointRegistry] Runtime endpoint registry is in extended mode gathering usage statistics of all incoming and outgoing endpoints (cache limit: 1000) [main]
29/01/20 14:13:39,147 INFO [QuartzComponent] Setting org.quartz.scheduler.jmx.export=true to ensure QuartzScheduler(s) will be enlisted in JMX. [main]
29/01/20 14:13:39,177 INFO [StdSchedulerFactory] Using default implementation for ThreadExecutor [main]
29/01/20 14:13:39,180 INFO [SimpleThreadPool] Job execution threads will use class loader of thread: main [main]
29/01/20 14:13:39,196 INFO [SchedulerSignalerImpl] Initialized Scheduler Signaller of type: class org.quartz.core.SchedulerSignalerImpl [main]
29/01/20 14:13:39,196 INFO [QuartzScheduler] Quartz Scheduler v.2.3.0 created. [main]
29/01/20 14:13:39,197 INFO [RAMJobStore] RAMJobStore initialized. [main]
29/01/20 14:13:39,202 INFO [QuartzScheduler] Scheduler meta-data: Quartz Scheduler (v2.3.0) 'DefaultQuartzScheduler-camel' with instanceId 'NON_CLUSTERED'
Scheduler class: 'org.quartz.core.QuartzScheduler' - running locally.
NOT STARTED.
Currently in standby mode.
Number of jobs executed: 0
Using thread pool 'org.quartz.simpl.SimpleThreadPool' - with 10 threads.
Using job-store 'org.quartz.simpl.RAMJobStore' - which does not support persistence. and is not clustered.
[main]
29/01/20 14:13:39,203 INFO [StdSchedulerFactory] Quartz scheduler 'DefaultQuartzScheduler-camel' initialized from an externally provided properties instance. [main]
29/01/20 14:13:39,203 INFO [StdSchedulerFactory] Quartz scheduler version: 2.3.0 [main]

Error sending messages from jetty to the queue(use camel)

I use servicemix. I'm trying to send messages from jetty to the queue, but I get the following error:
enter image description here
my blueprint:
<camelContext xmlns="http://camel.apache.org/schema/blueprint">
<route>
<from uri="jetty:http://localhost:8180/test"/>
<to uri="activemq://events_test" />
</route>
</camelContext>
if i use route from jetty to file - everything works as it should
Exchange pattern of your route is InOut, so your jetty consumer waiting response from activemq producer. Response will appear if you have activemq consumer that will process your jetty request. If activemq producer shouldn't make response and you need just save request in queue use "inOnly" instead if "to", like this:
<inOnly uri="activemq://events_test" />

CamelContext: Failed create route contain quartz when database is unreachable

My bundle installed into karaf container 4.0.7, that use camel-quartz22.17.3
In camelContext I have many routes such as "myRoute", it call a job quatrz (using camel-quartz2) configured in postgresql database:
<camelContext id="myCamelContext" xmlns="http://camel.apache.org/schema/blueprint">
<route id="myRoute">
<from
uri="quartz2://statGroup/startupTimer?trigger.repeatInterval=1&trigger.repeatCount=0" />
<bean ref="myProcessor" method="myMethod" />
</route>
</camelContext>
My issue is when I try to starting the karaf container and postgresql is stopped, I have the log problem below and the camelContext "myCamelContext" will be shutdown.
It's possible to create route that call camel-quartz but the database is unreachable ?
2016-10-14 17:21:40,201 | ERROR | FelixStartLevel | BlueprintCamelContext | 80 - org.apache.camel.camel-blueprint - 2.17.3 | Error occurred during starting Camel: CamelContext(statisticsContext) due Failed to create route myRoute: Route(myRoute)[[From[quartz2://stat... because of Failed to resolve endpoint: quartz2://statGroup/startupTimer?trigger.repeatCount=0&trigger.repeatInterval=1 due to: Failed to obtain DB connection from data source 'statQuartzDS': java.sql.SQLException: Could not retrieve datasource via JNDI url 'osgi:service/statQuartzDS' java.sql.SQLException: Unable to acquire a new connection from the pool
org.apache.camel.FailedToCreateRouteException: Failed to create route myRoute: Route(myRoute)[[From[quartz2://stat... because of Failed to resolve endpoint: quartz2://statGroup/startupTimer?trigger.repeatCount=0&trigger.repeatInterval=1 due to: Failed to obtain DB connection from data source 'statQuartzDS': java.sql.SQLException: Could not retrieve datasource via JNDI url 'osgi:service/statQuartzDS' java.sql.SQLException: Unable to acquire a new connection from the pool
at org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:201)
at org.apache.camel.impl.DefaultCamelContext.startRoute(DefaultCamelContext.java:974)[83:org.apache.camel.camel-core:2.17.3]
at org.apache.camel.impl.DefaultCamelContext.startRouteDefinitions(DefaultCamelContext.java:3301)[83:org.apache.camel.camel-core:2.17.3]
at org.apache.camel.impl.DefaultCamelContext.doStartCamel(DefaultCamelContext.java:3024)[83:org.apache.camel.camel-core:2.17.3]
at org.apache.camel.impl.DefaultCamelContext.access$000(DefaultCamelContext.java:175)[83:org.apache.camel.camel-core:2.17.3]
at org.apache.camel.impl.DefaultCamelContext$2.call(DefaultCamelContext.java:2854)
at org.apache.camel.impl.DefaultCamelContext$2.call(DefaultCamelContext.java:2850)
at org.apache.camel.impl.DefaultCamelContext.doWithDefinedClassLoader(DefaultCamelContext.java:2873)[83:org.apache.camel.camel-core:2.17.3]
at org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:2850)[83:org.apache.camel.camel-core:2.17.3]
at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61)
at org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:2819)[83:org.apache.camel.camel-core:2.17.3]
at org.apache.camel.blueprint.BlueprintCamelContext.start(BlueprintCamelContext.java:180)
at org.apache.camel.blueprint.BlueprintCamelContext.maybeStart(BlueprintCamelContext.java:212)
at org.apache.camel.blueprint.BlueprintCamelContext.serviceChanged(BlueprintCamelContext.java:150)
at org.apache.felix.framework.util.EventDispatcher.invokeServiceListenerCallback(EventDispatcher.java:991)[org.apache.felix.framework-5.4.0.jar:]
at org.apache.felix.framework.util.EventDispatcher.fireEventImmediately(EventDispatcher.java:839)[org.apache.felix.framework-5.4.0.jar:]
at org.apache.felix.framework.util.EventDispatcher.fireServiceEvent(EventDispatcher.java:546)[org.apache.felix.framework-5.4.0.jar:]
at org.apache.felix.framework.Felix.fireServiceEvent(Felix.java:4557)[org.apache.felix.framework-5.4.0.jar:]
at org.apache.felix.framework.Felix.registerService(Felix.java:3549)[org.apache.felix.framework-5.4.0.jar:]
at org.apache.felix.framework.BundleContextImpl.registerService(BundleContextImpl.java:348)
at org.apache.felix.framework.BundleContextImpl.registerService(BundleContextImpl.java:355)
at org.apache.camel.blueprint.BlueprintCamelContext.init(BlueprintCamelContext.java:100)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)[:1.8.0_101]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)[:1.8.0_101]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)[:1.8.0_101]
at java.lang.reflect.Method.invoke(Method.java:498)[:1.8.0_101]
at org.apache.aries.blueprint.utils.ReflectionUtils.invoke(ReflectionUtils.java:299)[12:org.apache.aries.blueprint.core:1.6.2]
at org.apache.aries.blueprint.container.BeanRecipe.invoke(BeanRecipe.java:980)[12:org.apache.aries.blueprint.core:1.6.2]
at org.apache.aries.blueprint.container.BeanRecipe.runBeanProcInit(BeanRecipe.java:736)[12:org.apache.aries.blueprint.core:1.6.2]
at org.apache.aries.blueprint.container.BeanRecipe.internalCreate2(BeanRecipe.java:848)[12:org.apache.aries.blueprint.core:1.6.2]
at org.apache.aries.blueprint.container.BeanRecipe.internalCreate(BeanRecipe.java:811)[12:org.apache.aries.blueprint.core:1.6.2]
at org.apache.aries.blueprint.di.AbstractRecipe$1.call(AbstractRecipe.java:79)[12:org.apache.aries.blueprint.core:1.6.2]
at java.util.concurrent.FutureTask.run(FutureTask.java:266)[:1.8.0_101]

Camel and Spring Integration

I want to test camel spring integration example from the apache camel site
http://camel.apache.org/springintegration.html but I am getting the exception
org.apache.camel.RuntimeCamelException: org.springframework.integration.MessageDeliveryException: Dispatcher has no subscribers for channel outputchannel.
my short code is given below:
<channel id="inChannel"/>
<channel id="outputChannel"/>
<beans:bean id="greeting" class="com.javarticles.spring.integration.Greeting"/>
<service-activator input-channel="inChannel" ref="greeting" method="sayHello" output-channel="outputChannel"/>
<camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
<route>
<from uri="activemq:activemqsource"/>
<to uri="log:input"/>
<to uri="spring-integration:inChannel? inputChannel=outputChannel"/>
<to uri="log:output"/>
</route>
I tried to search related problems but I did not get with camel could any one tell me how to subscribe the outputchannel
According to the Camel documentation mentioned by you, the config should be like this:
<to uri="spring-integration:inputChannel?inOut=true&inputChannel=outputChannel"/>
Your issue is inOut=true:
The exchange pattern that the Spring integration endpoint should use. If inOut=true then a reply channel is expected, either from the Spring Integration Message header or configured on the endpoint.

Resources