opc-ua milo项目的骆驼路线

问题描述 投票:0回答:2

我正在创建一个实现OPC-UA连接的Camel,Spring启动应用程序。直到现在,我成功地运行了从Eclipse milo github repository获得的示例。

现在,我的任务是创建一个camel路由,它将连接到另一台机器上运行的opc-ua服务器,从那里读取数据并存储在jms队列中。

直到现在,我能够运行BrowseNodeExample和ReadNodeExample,我将连接到服务器模拟器(Top Server V6)。在示例代码中,当连接到服务器时,服务器的端点为 - "opc.tcp://127.0.0.1:49384/SWToolbox.TOPServer.V6"

现在在骆驼路由段中,在.configure()部分,我应该在.from()部分写什么。这段代码如下 -

@Override
    public void configure() throws Exception {
        from("opc.tcp://127.0.0.1:49384/SWToolbox.TOPServer.V6")
        .process(opcConnection)
        .split(body().tokenize(";"))
        .to(opcBean.getKarafQueue());
    }

在寻找解决方案时,我遇到了一个选项:milo-server:tcp://127.0.0.1:49384/SWToolbox.TOPServer.V6/nodeId=2&namespaceUri=http://examples.freeopcua.github.io。我尝试过,但它没有用。在这两种情况下,我得到以下错误:

ResolveEndpointFailedException:无法解析端点:(给定端点),原因是:找不到scheme的组件:milo-server(或opc.tcp)

eclipse apache-camel opc-ua milo
2个回答
0
投票

您可能希望将camel-opc组件添加到项目中。

我在Github找到了一个

以及用于OPC-UA连接的maven central上的milo版本。

希望有所帮助:-)


0
投票

ResolveEndpointFailedException非常清楚,Camel找不到组件。这意味着自动发现无法在META-INF目录中加载定义。

你有没有检查过你的胖罐/战争中是否含有骆驼缸?

作为解决方法,您可以手动添加组件

CamelContext context = new DefaultCamelContext();
context.addComponent("foo", new FooComponent(context));

http://camel.apache.org/how-do-i-add-a-component.html

或者在你的情况下

@Override
public void configure() throws Exception {
    getContext().addComponent("milo-server", new org.apache.camel.component.milo.server.MiloServerComponent());

    from("milo-server:tcp://127.0.0.1:49384/SWToolbox.TOPServer.V6/nodeId=2&namespaceUri=http://examples.freeopcua.github.io")
    ...
}

此外,请注意milo-server启动OPC UA服务器。据我所知,您想要连接到OPC UA服务器。因此,您需要milo-client组件。

camel-milo client at github

© www.soinside.com 2019 - 2024. All rights reserved.