【问题标题】:Camel SMPP - ServerCamel SMPP - 服务器
【发布时间】:2018-09-28 05:26:26
【问题描述】:

我熟悉 Camel-SMPP,它也非常适合我的消费者和生产者路线。我正在使用 Selenium SMPP SIM 进行测试。

来自 uri="smpp://smppclient@127.0.0.1:8056?password=password&systemType=consumer"/>

to uri="smpp://smppclient@localhost:2775?password=password&&systemType=producer"/>

但是,我想让我的 Camel 作为服务器运行(它接受来自众多客户端的 SMS)。我当前的 From 路由与一个 SMS 发送者紧密耦合。如何将其修改为通用服务器。骆驼有可能吗?

【问题讨论】:

  • 你有这些客户的名单吗?我的意思是,如果您在接受请求之前有这样的清单,那可能是可以实现的。
  • 我没有客户名单
  • 我有一些解决方案可以分享,但您从哪里获取动态客户端?请求、数据库还是什么?

标签: apache-camel jbossfuse fuseesb apache-servicemix jsmpp


【解决方案1】:

如果我理解你的问题,你有:

  • 127.0.0.1:8056 作为短信客户端
  • localhost:2775 作为短信发件人

看起来像这样

from:client1 ----> to:sender1

假设您想将更多短信客户端连接到您的短信发件人

from:client1 -----> to:sender1
from:client2 ----/
from:client3 ---/

您需要做的就是添加更多 from 节点。

我认为您正在使用 springish xml 文件来配置 Camel。这意味着您以声明方式执行此操作,而骆驼执行的操作与您在 xml 文件中声明的一样多。没有for循环什么的。因此,从字面上看,您需要在 xml 中添加更多 from uri="smpp://smppclient@127.0.0.1:8056?password=password&systemType=consumer"/> 行。以其他方式,您可以使用骆驼 java API 动态配置/添加节点。因此,您可以从 DB 或其他任何方式配置或添加节点。

好吧,但是您必须添加尽可能多的 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,这样您很容易排队。

【讨论】:

  • 如问题中所述,我没有发件人列表。我将如何配置 from
  • 啊,所以,您不想在 Camel 中配置所有客户端并从 smppclient 拉取所有请求。但是您想将请求从 smppclient 推送到通用骆驼 smpp 接收器。因此,您不需要从节点为每个客户端进行配置。我说的对吗?
  • 问题是您的 smppclient 是否能够推送或连接到您的骆驼通用服务器。否则我无法想象如何配置这样的东西。
  • 是的..问题是关于骆驼充当服务器的。
  • 您可以使用 Netty 或 Mina 组件公开一个端口进行通信。正如我所说,问题是您的 smppclient 是否能够连接到您的骆驼服务器。还有一种简单的方法是如何将消息发送到骆驼,那就是使用文件或 jms。在第一种情况下,您的 smppclient 将在特定文件夹中生成一个文件,然后骆驼会使用它。在第二种情况下,您将需要某种 MQ(ActiveMQ),smppclient 会将消息放入队列,camel 将从队列中使用这些消息。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2014-02-21
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多