我熟悉 Camel-SMPP,它也适用于我的消费者和生产者路线。我正在使用 Selenium SMPP SIM 进行测试。
来自 uri="smpp://smppclient@127.0.0.1:8056?password=password&systemType=consumer"/>
到 uri="smpp://smppclient@localhost:2775?password=password&&systemType=producer"/>
但是,我想让我的 Camel 作为服务器运行(它接受来自众多客户端的 SMS)。我当前的 From 路由与一个 SMS 发送者紧密结合。如何将其修改为通用服务器。 Camel 有可能吗?
最佳答案
如果我理解你的问题,你有:
它看起来像这样
from:client1 ----> to:sender1
假设您想连接更多 短信客户端给您的 短信发件人 .
from:client1 -----> to:sender1
from:client2 ----/
from:client3 ---/
您需要做的就是添加更多 来自 节点。
我认为您正在使用 springish xml 文件来配置 Camel。这意味着您以声明方式进行操作,而 Camel 所做的与您在 xml 文件中声明的一样多。没有 for 循环什么的。因此,从字面上看,您需要添加更多
from uri="smpp://smppclient@127.0.0.1:8056?password=password&systemType=consumer"/>
行到您的 xml 中。以其他方式,您可以使用 Camel Java API 来动态配置/添加您的节点。因此,您可以从数据库或其他任何方式配置或添加您的节点。好吧,但你必须添加尽可能多的
to uri="smpp://smppclient@localhost:2775?password=password&&systemType=producer"/>
节点,这不完全是我们的意思。为了解决这个问题,我们在两者之间添加了一个抽象节点。它看起来像:from:client1 -----> direct:sender ----> to:sender1
from:client2 ----/
from:client3 ---/
所以你的代码将是:
from uri="smpp://smppclient@127.0.0.1:8056?password=password&systemType=consumer"/>
to uri="direct://sender"
from uri="smpp://smppclient2@...."/>
to uri="direct://sender"
from uri="smpp://smppclient3@..."/>
to uri="direct://sender"
from uri="direct://sender"
to uri="smpp://smppclient@localhost:2775?password=password&&systemType=producer"/>
您可以考虑使用
seda
而不是 direct
所以你很容易排队。
关于apache-camel - Camel SMPP - 服务器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20467904/