使用 mina 的 ActiveMQ 设置 TCP 套接字

发布于 2024-07-07 17:32:57 字数 1465 浏览 8 评论 0原文

我正在尝试设置 activemq 和 mina 的简单演示。 我编辑了 activemq.xml 文件中的camelContext,以包含两个 mina tcp 套接字、两个队列和路由,如下所示:

listenerA -> qA-> 监听者B
监听器B -> qB-> ListenerA

目的是在两个 telnet 会话之间进行双向传递。 稍后,我将添加更多奇特的功能,例如过滤、路由到主题以及每个侦听器上我自己的编解码器。

这是我的骆驼上下文:

    <!-- You can use a <package> element for each root package to search for Java routes --> 
    <package>com.myco.codec</package> 

    <endpoint id="listener_A" uri="mina:tcp://localhost:42000?textline=true"/> 
    <endpoint id="listener_B" uri="mina:tcp://localhost:42001?textline=true"/> 

            <!-- You can use Spring XML syntax to define the routes here using the <route> element --> 
    <route> 
        <from ref="listener_A"/> 
        <to uri="activemq:qA"/> 
    </route> 
    <route> 
        <from uri="activemq:qB"/> 
        <to ref="listener_A"/> 
    </route> 
    <route> 
        <from ref="listener_B"/> 
        <to uri="activemq:qB"/> 
    </route> 
    <route> 
        <from uri="activemq:qA"/> 
        <to ref="listener_B"/> 
    </route> 
</camelContext> 

当我启动 activemq 时,出现异常:

org.apache.camel.NoSuchEndpointException: No endpoint can be find for: mina:tcp://localhost:42000?textline=true

我是否明确需要添加 mina bean? 如果是的话,在哪里以及如何进行?

I am trying to setup a simple demo of activemq and mina. I edited the camelContext in the activemq.xml file to include two mina tcp sockets, two queues and routes as such:

listenerA -> qA -> listenerB
listenerB -> qB -> listenerA

The intent is to have two way pass through between two telnet sessions. Later, I will add more fancy features such as filtering, routing to a topic and my own codec on each listener.

Here is my camelcontext:

    <!-- You can use a <package> element for each root package to search for Java routes --> 
    <package>com.myco.codec</package> 

    <endpoint id="listener_A" uri="mina:tcp://localhost:42000?textline=true"/> 
    <endpoint id="listener_B" uri="mina:tcp://localhost:42001?textline=true"/> 

            <!-- You can use Spring XML syntax to define the routes here using the <route> element --> 
    <route> 
        <from ref="listener_A"/> 
        <to uri="activemq:qA"/> 
    </route> 
    <route> 
        <from uri="activemq:qB"/> 
        <to ref="listener_A"/> 
    </route> 
    <route> 
        <from ref="listener_B"/> 
        <to uri="activemq:qB"/> 
    </route> 
    <route> 
        <from uri="activemq:qA"/> 
        <to ref="listener_B"/> 
    </route> 
</camelContext> 

When I start activemq I get an exception:

org.apache.camel.NoSuchEndpointException: No endpoint could be found for: mina:tcp://localhost:42000?textline=true

Do I explicitly need to add a mina bean? If so where and how?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

假情假意假温柔 2024-07-14 17:32:57

你的类路径上有camel-mina.jar 和mina jar 吗?

基于此处的线程 似乎已经修复了它。

Do you have camel-mina.jar and the mina jars on the classpath?

Based on the thread here it seems to have fixed it.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文