Reputation: 5585
I am pretty new to spring-boot, apache camel and ActiveMQ
broker. I am trying to create an application which will send a message to a queue which I am hosting locally using Camel for routing.
When I run the app, I get the error :
ERROR org.apache.camel.FailedToCreateRouteException: Failed to create route route1 at: >>> To[activemq:queue:myQueue] <<< in route: Route(route1)[[From[direct:firstRoute]] -> [SetBody[constant... because of Failed to resolve endpoint: activemq://queue:myQueue due to: No component found with scheme: activemq
POM:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-activemq</artifactId>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-spring-boot-starter</artifactId>
<version>2.22.0</version>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-core</artifactId>
<version>2.22.0</version>
</dependency>
MsgRouteBuilder:
public void configure() throws Exception {
from("direct:firstRoute")
.setBody(constant("Hello"))
.to("activemq:queue:myQueue");
}
application.yaml:
activemq:
broker-url: tcp://localhost:61616
user: meAd
password: meAd
MainApp.java:
package me.ad.myCamel;
import org.apache.camel.CamelContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.EnableAspectJAutoProxy;
import me.ad.myCamel.router.MessageRouteBuilder;
@SpringBootApplication
@EnableAutoConfiguration(exclude={DataSourceAutoConfiguration.class})
@EnableAspectJAutoProxy(proxyTargetClass = true)
@EnableCaching
public class MeAdApp implements CommandLineRunner {
private static final Logger LOG = LoggerFactory.getLogger(MeAdApp.class);
@Autowired
private CamelContext camelContext;
public static void main(String[] args) {
try {
SpringApplication.run(MeAdApp.class, args);
} catch (Exception ex) {
LOG.error(ex.getMessage(), ex);
}
}
@Override
public void run(String... args) throws Exception {
LOG.info("Starting MeAdApp...");
}
@Bean
public MsgRouteBuilder msgRouteBuilder() throws Exception {
MsgRouteBuilder routeBuilder = new MsgRouteBuilder();
camelContext.addRoutes(routeBuilder);
return routeBuilder;
}
}
Can anybody please point me to the right direction as to why I am getting this error ? Any help is greatly appreciated .
Upvotes: 1
Views: 1264
Reputation: 1060
You need to add camel-activemq in the POM.xml file
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-activemq</artifactId>
<version>3.2.0</version>
</dependency>
Upvotes: 2
Reputation: 76
Your application doesn't know the component activemq. To resolve that, you need to add the dependency of camel-activemq in your pom.xml file :
<properties>
...
<activemq.version>3.1.0</activemq.version>
</properties>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-activemq</artifactId>
<version>${activemq.version}</version>
</dependency>
Upvotes: 1