Apache Camel是一个功能强大的开源集成框架,基于已知的企业集成模式和强大的Bean集成
使用 Apache Camel Servlet 组件获取状态为 404 的白标签页面
我正在使用 Camel 向其他系统提供 Web 服务。我编写了一个简单的 Camel 消耗路由来接受 http 请求。我可以使用 Springboot 成功启动 Camel 应用程序。但是...
Quartz 组件未在 Spring Boot 应用程序上调用驼峰处理器
我创建了具有以下依赖项的简单 JBossFUSE spring boot 应用程序 我创建了具有以下依赖项的简单 JBossFUSE spring boot 应用程序 <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>sample.fuse</groupId> <artifactId>sample-FUSE</artifactId> <version>0.0.1-SNAPSHOT</version> <packaging>war</packaging> <name>springboot-camel-restdsl-api</name> <description>Camel SpringBoot REST API Example with REST DSL</description> <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>1.5.9.RELEASE</version> <relativePath /> <!-- lookup parent from repository --> </parent> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> <java.version>1.8</java.version> <start-class>sample.fuse.UrarepSpringBootApplication</start-class> </properties> <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> <exclusions> <exclusion> <groupId>org.apache.tomcat.embed</groupId> <artifactId>tomcat-embed-websocket</artifactId> </exclusion> </exclusions> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-jpa</artifactId> </dependency> <dependency> <groupId>org.apache.camel</groupId> <artifactId>camel-spring-boot-starter</artifactId> <version>2.19.0</version> </dependency> <dependency> <groupId>org.apache.camel</groupId> <artifactId>camel-servlet-starter</artifactId> <version>2.19.0</version> </dependency> <dependency> <groupId>org.apache.camel</groupId> <artifactId>camel-jackson</artifactId> <version>2.19.0</version> </dependency> <dependency> <groupId>javax</groupId> <artifactId>javaee-api</artifactId> <version>7.0</version> </dependency> <dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-databind</artifactId> </dependency> <dependency> <groupId>com.ibm.mq</groupId> <artifactId>mq-jms-spring-boot-starter</artifactId> <version>2.3.2</version> </dependency> <dependency> <groupId>com.ibm.mq</groupId> <artifactId>com.ibm.mq.allclient</artifactId> <version>9.2.0.0</version> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-artemis</artifactId> </dependency> <dependency> <groupId>org.apache.camel</groupId> <artifactId>camel-quartz</artifactId> <version>2.13.0</version> </dependency> </dependencies> <build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> </plugin> </plugins> </build> </project> 然后我使用以下内容创建了简单的 RouteBuilder package sample.fuse.routebuilder; import com.fasterxml.jackson.core.JsonProcessingException; import org.apache.camel.Exchange; import org.apache.camel.LoggingLevel; import org.apache.camel.builder.RouteBuilder; import org.apache.camel.model.rest.RestBindingMode; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import sample.fuse.process.*; import javax.ws.rs.core.MediaType; @Component public class MyRouteBuilder extends RouteBuilder { static Logger LOG = LoggerFactory.getLogger(MyRouteBuilder.class); @Autowired TestProcessor testProcessor; @Override public void configure() throws Exception { from("quartz://seasonParkingProcessorCron?cron=10+*+*+*+*+?&trigger.timeZone=America/Chicago&job.name=seasonParkingProcessorCron") .log(LoggingLevel.INFO, "seasonParkingProcessorCron job kicked off") .process(testProcessor); } } 示例处理器有以下内容。 package sample.fuse.process; import org.apache.camel.Exchange; import org.apache.camel.Processor; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.core.env.Environment; import org.springframework.stereotype.Component; import org.springframework.stereotype.Service; import sample.fuse.repository.MevEhtVideoImagesRepository; import java.util.Calendar; @Service @Component public class TestProcessor implements Processor { static Logger LOG = LoggerFactory.getLogger(TestProcessor.class); @Autowired Environment environment; @Autowired private MevEhtVideoImagesRepository mevEhtVideoImagesRepository; public TestProcessor(){ } @Override public void process(Exchange exchange) throws Exception { String body= (String) exchange.getIn().getBody(); LOG.info("TestProcessor Called with exchange: " + body); System.out.println("AAAAAAAAAAAAAa"); exchange.getOut().setBody(body+" "+ Calendar.getInstance().getTime()); } } 我希望每 10 秒调用一次 Processor 方法并打印日志。然而,它在日志上给出以下错误。 11:58:10,013警告[org.apache.camel.component.quartz.QuartzEndpoint](DefaultQuartzScheduler-camel-1_Worker-1)无法使用上下文执行Quartz作业:JobExecutionContext:触发器:'Camel.seasonParkingProcessorCron作业:DEFAULT.seasonParkingProcessorCron fireTime : 'Thu Dec 21 11:58:10 SGT 2023 ScheduleFireTime: Thu Dec 21 11:58:10 SGT 2023 previousFireTime: 'null nextFireTime: Thu Dec 21 11:59:10 SGT 2023 isRecovering: false refireCount: 0 因为处理器不是开始:RoundRobinLoadBalancer 还有其他人遇到过这种错误吗? 您必须为骆驼石英使用相同版本的骆驼核心版本。但是在你的pom文件中camel-core和camel-quartz版本应该匹配。 pom 文件中的camel-quartz 依赖项应更新如下 <dependency> <groupId>org.apache.camel</groupId> <artifactId>camel-quartz</artifactId> <version>2.19.0</version> </dependency> 然后你的MyRouteBuilder类配置方法内容需要更改如下。 from("quartz://seasonParkingProcessorCron?cron=10+*+*+*+*+?") .log(LoggingLevel.INFO, "seasonParkingProcessorCron job kicked off") .process(testProcessor); 希望这将有助于解决您的问题。
让 Apache Camel 与 Amazon S3 存储桶配合使用所需的最低权限是什么?
我正在尝试使用 Apache Camel + Amazon S3 制作一个应用程序。只是一个简单的情况,文件将由端点接收、处理并发送到 S3 存储桶。 s3.bucket=我的桶 c...
使用 Apache Camel 列出来自 Springboot 的 AWS S3 存储桶内容
我有一个运行 v2.5.4 的 sprintboot 项目,运行良好。 我可以访问 S3,并且可以列出我创建的存储桶的内容。所以我想尝试使用 Apache Camel 来尝试
编写 JUnit 4 测试类来测试 Apache Camel 路由
我有一个用于 cron 作业目的的 Maven 项目,我必须为测试类编写逻辑,以通过 JUnit 4 测试 Apache Camel 路由。该应用程序运行良好。我是...
我有一个用于 cron 作业目的的 Maven 项目,我必须为测试类编写逻辑,以通过 Junit4 测试 apache 骆驼路由。该应用程序运行完美。我先写...
我正在尝试使用过滤器在我的 Camel Route 中过滤来自 activeMQ 的消息,但当我使用 || 等运算符时,我无法使其工作。或者 && 所以基本上我收到了来自 acti 的消息...
在 Apache Camel 路由中调用通过 Bearer 令牌身份验证保护的其余 api
我需要从我的 Apache Camel 路由调用 Rest API。 Rest API 使用可在其他 API 上获取的令牌进行保护。 我的演示路线如下所示: 来自(“直接:物联网”)...
为什么 @BeanInject 不能与 Java 17 一起使用?
我使用 Apache Camel 的 BeanInject 来初始化我的其余模板 bean 对象。像这样: @BeanInject("restTemplateBean") 私有 RestTemplate RestTemplateBean; RestTemplateBean 定义为...
在没有 Spring Boot 的情况下使用 Apache Camel Route 进行表单数据上传的问题
您好 Stack Overflow 社区, 我目前正在开发一个没有 Spring Boot 的 Apache Camel 项目,并且在创建处理表单数据的路由方面面临着挑战。我遇到过
我正在用骆驼编写一些路线,我想使用处理器进行一些转换。我有一个属性文件,它工作正常。 来自(URI_LOG) .routeId("{{PREFIX_LOG}}.准备...
Apache Camel Kafka 消费者即使在暂停后也会消费消息
我在Camel路由中有一个Kafka消费者,它消费消息如下: 来自(“kafka:MykafkaTopic?brokers = localhost:9092&autoCommitEnable = false&allowManualCommit = true&maxPollRec ...
Apache Camel Spring Boot 健康检查暴露级别
我使用的是Apache Camel Spring boot(3.1.2),Camel版本是4.0.0。健康检查已启用,它正在工作,但是 /health 总是返回 UP/DOWN,没有详细信息,即使我将暴露级别设置为 f...
我们有这样的场景:我们将 Camel 应用程序作为 jar 交付给客户,并允许客户对其进行自定义,在某些情况下,他们可能希望替换 Camel 路由中的节点, 是吗
我有一个生产者,可以为特定主题生成消息: 制作人: // 生成一条消息到 Kafka 主题 字符串主题 = "dev.topic.proxy"; 字符串键=“一些-...
我正在尝试使用 apache Camel 调用 REST API,但出现异常 org.apache.camel.FailedToCreateRouteException:无法在以下位置创建路由route1:>>> To[http://devloyalty.darkwing.io/api/test_l...
阿帕奇骆驼。 FluentProducerTemplate 与 netty-http 组件。带有超时的请求方法不起作用
情况如下。 我正在尝试将请求发送到错误的 IP,并希望捕获请求超时异常。 虽然我向错误的IP发送了请求,但它正常结束。 来源如下。 特...
Camel - 如何在以 xml 编写的路由中使用文件中设置的属性
我在没有 spring 的情况下在骆驼 xml 路由中使用属性时遇到了一些麻烦。我正在尝试使用“to uri”标签中的属性,到目前为止我已经实现了这个结果: 我在没有 spring 的情况下使用camel xml 路由中的属性时遇到了一些问题。我正在尝试使用“to uri”标签中的属性,到目前为止我已经实现了这个结果: <to uri="properties:{{url}}{{delimiter}}throwExceptionOnFailure=false?locations=endpoint.properties"/> url 是“http4://localhost:8080”之类的键,分隔符是“?”的键。我使用此解决方法是为了能够对 http4 组件使用 throwExceptionOnFailure 选项并避免 FailedToCreateRouteException。 还有其他方法可以不出现异常吗?我还尝试使用 simple 和recipientList 获得另一个解决方案,但到目前为止我只得到错误。 提前谢谢您 您需要确保属性占位符已加载才能使用。 PropertiesComponent props = camelContext.getComponent("properties", PropertiesComponent.class); props.setLocation("classpath:yourfile.properties:); 在 XML 中: <bean id="props" class="org.apache.camel.component.properties.PropertiesComponent"> <property name="location" value="classpath:yourfile.properties" /> </bean>
您何时会在 Apache Camel 中替换 Exchange 的消息而不是消息正文?
我正在使用 Apache Camel,通常仅在转换后替换消息正文或设置一些标头和属性。 替换整个消息的有效用例是什么...