Apache Camel Web3j组件

时间:2018-06-13 21:10:42

标签: java websocket apache-camel geth quorum

我正在尝试使用apache camel-web3j组件连接到本地ganache testnet节点:https://github.com/apache/camel/blob/master/components/camel-web3j/src/main/docs/web3j-component.adoc

即使这没有正式发布,我也可以在本地构建它,并在我的maven项目中包含作为本地依赖项。当我按照github网站上的说明操作时,收到错误:

java.lang.RuntimeException: Provided file socket cannot be opened: 127.0.0.1:7545
    at org.web3j.protocol.ipc.UnixDomainSocket.<init>(UnixDomainSocket.java:41)
    at org.web3j.protocol.ipc.UnixDomainSocket.<init>(UnixDomainSocket.java:27)
    at org.web3j.protocol.ipc.UnixIpcService.getIO(UnixIpcService.java:21)
    at org.web3j.protocol.ipc.IpcService.performIO(IpcService.java:50)
    at org.web3j.protocol.Service.send(Service.java:31)
    at org.web3j.protocol.core.Request.send(Request.java:71)
    at org.web3j.protocol.core.filters.BlockFilter.sendRequest(BlockFilter.java:24)
    at org.web3j.protocol.core.filters.Filter.run(Filter.java:45)
    at org.web3j.protocol.rx.JsonRpc2_0Rx.run(JsonRpc2_0Rx.java:73)
    at org.web3j.protocol.rx.JsonRpc2_0Rx.lambda$ethBlockHashObservable$0(JsonRpc2_0Rx.java:46)
    at rx.Observable.unsafeSubscribe(Observable.java:10142)
    at rx.internal.operators.OnSubscribeMap.call(OnSubscribeMap.java:48)
    at rx.internal.operators.OnSubscribeMap.call(OnSubscribeMap.java:33)
    at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48)
    at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30)
    at rx.Observable.subscribe(Observable.java:10238)
    at rx.Observable.subscribe(Observable.java:10205)
    at rx.Observable.subscribe(Observable.java:10086)
    at org.apache.camel.component.web3j.Web3jConsumer.doStart(Web3jConsumer.java:100)
    at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61)
    at org.apache.camel.impl.DefaultCamelContext.startService(DefaultCamelContext.java:3518)
    at org.apache.camel.impl.DefaultCamelContext.doStartOrResumeRouteConsumers(DefaultCamelContext.java:3835)
    at org.apache.camel.impl.DefaultCamelContext.doStartRouteConsumers(DefaultCamelContext.java:3771)
    at org.apache.camel.impl.DefaultCamelContext.safelyStartRouteServices(DefaultCamelContext.java:3691)
    at org.apache.camel.impl.DefaultCamelContext.doStartOrResumeRoutes(DefaultCamelContext.java:3455)
    at org.apache.camel.impl.DefaultCamelContext.doStartCamel(DefaultCamelContext.java:3309)
    at org.apache.camel.impl.DefaultCamelContext.access$000(DefaultCamelContext.java:202)
    at org.apache.camel.impl.DefaultCamelContext$2.call(DefaultCamelContext.java:3093)
    at org.apache.camel.impl.DefaultCamelContext$2.call(DefaultCamelContext.java:3089)
    at org.apache.camel.impl.DefaultCamelContext.doWithDefinedClassLoader(DefaultCamelContext.java:3112)
    at org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:3089)
    at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61)
    at org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:3026)
    at org.apache.camel.main.Main.doStart(Main.java:129)
    at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61)
    at org.apache.camel.main.MainSupport.run(MainSupport.java:168)
    at com.optum.propel.commons.startup.AppInit.startMicroService(AppInit.java:141)
    at com.optum.propel.commons.startup.AppInit.lambda$main$0(AppInit.java:81)
    at java.lang.Thread.run(Thread.java:745)
Caused by: java.io.IOException: No such file or directory
    at jnr.unixsocket.UnixSocketChannel.doConnect(UnixSocketChannel.java:127)
    at jnr.unixsocket.UnixSocketChannel.connect(UnixSocketChannel.java:136)
    at jnr.unixsocket.UnixSocketChannel.open(UnixSocketChannel.java:68)
    at org.web3j.protocol.ipc.UnixDomainSocket.<init>(UnixDomainSocket.java:35)
    ... 38 common frames omitted
{ "date_time":"2018-06-13 17:04:48,617", "thread":"[Thread-2]", "log_level":"INFO ", "class_name":"Web3jConsumer", "log_message":"Subscribed: org.apache.camel.component.web3j.Web3jConfiguration@1f7fe1b2" }
{ "date_time":"2018-06-13 17:04:48,617", "thread":"[Thread-2]", "log_level":"INFO ", "class_name":"DefaultCamelContext", "log_message":"Route: rsRoute started and consuming from: web3j://127.0.0.1:7545?operation=BLOCK_OBSERVABLE" }

我很困惑,因为它首先抛出一个错误,然后说它成功连接。此外,当我将操作更改为ETH_GET_BLOCK_BY_HASH时,它会抛出不受支持的操作异常。

我想知道是否有人试图使用这个组件并看到了问题?

我使用的端点是: web3j://127.0.0.1:7545?operation=BLOCK_OBSERVABLE