apache-camel - 由于 Corda 节点的连接(RPC 连接)错误,Camel 上下文无法启动
问题描述
我的 Spring Boot Camel 应用程序使用 camel-corda 组件,并且当 corda 节点(RPC 连接)未启动和运行时无法启动
我目前的骆驼路线是
@Component
class CordaOpsRouteBuilder() : RouteBuilder() {
override fun configure() {
from("timer://terminate?repeatCount=1&delay=20").autoStartup("{{corda.terminate.node}}")
.to("direct:terminate-node")
from("direct:terminate-node")
.log("Draining and shutting down node")
.to("corda://{{corda.rpc.username}}:{{corda.rpc.password}}@{{corda.rpc.host}}:{{corda.rpc.port}}?operation=TERMINATE")
.delay(10000).asyncDelayed()
.to("direct:shutdown")
from ("direct:shutdown")
.setHeader(Exchange.HTTP_METHOD, constant("POST"))
.to("http://localhost:{{server.port}}/actuator/shutdown")
}
}
堆栈跟踪 :
Caused by: org.apache.camel.RuntimeCamelException: net.corda.client.rpc.RPCException: Cannot connect to server(s). Tried with all available servers.
at org.apache.camel.RuntimeCamelException.wrapRuntimeCamelException(RuntimeCamelException.java:52) ~[camel-api-3.0.0-RC3.jar:3.0.0-RC3]
at org.apache.camel.support.ChildServiceSupport.start(ChildServiceSupport.java:63) ~[camel-support-3.0.0-RC3.jar:3.0.0-RC3]
启动过程中如何处理上述RuntimeCamelException?
解决方案
请lazyStartProducer=true
在端点上使用参数corda
以确保即使路由corda
不可用(延迟启动)也会启动。
https://camel.apache.org/components/latest/corda-component.html
推荐阅读
- r - 带有仅包含 r 中数字的字符串的向量的最大值或最小值。向量中“字符串”数字的优先级
- php - 没有换行
, 值来自 textarea
- python-2.7 - InvalidArgumentError indices[i,0] = x is not in [0, x) in keras
- python - VB6 DoEvents 的 Python 等价物
- vb.net - 使用 DropdownStyle=DropDownList 在下拉列表中忽略输入按键
- string - Like 运算符无法检测到字符串中的字符
- docker - 运行 JIB 镜像创建的容器
- jquery - 如何在codeigniter的视图中将值从控制器传递给jquery
- dart - Flutter:使用全局流?
- arrays - 尝试对两个数组的字节求和时出现溢出异常