【问题标题】:SMPP Connection pooling and SmppSessionFactoryBeanSMPP 连接池和 SmppSessionFactoryBean
【发布时间】:2015-11-12 09:56:28
【问题描述】:

我正在使用 int-smpp:outbound-gateway 并提供 SmppSessionFactoryBean。 到目前为止,这一直是一个单租户系统,但我被要求制作这个多租户系统。所以我相信我需要为不同的租户 smpp 连接创建一个连接池。 smpp 出站网关可以做到这一点吗?

我想我可以创建一个接收 SmppSessionFactoryBean 的 SmppSessionBeanFactory,如果它不存在则创建一个 Smpp 会话,或者如果它确实存在则从池中获取它。

有没有更好的方法来做到这一点?

# 更新

这基本上就是我想要做的

<int:channel id="smppSessionFactoryChannel"/>

<int:header-enricher id=""
    input-channel="smppSessionFactoryChannel" output-channel="smppOutBoundGatewayChannel">
    <int:header name="smppSession" ref="SmppSessionFactoryBeanFactory" method="getObject"/>
</int:header-enricher>

<int:channel id="smppOutBoundGatewayChannel"/>

<int-smpp:outbound-gateway id="smppOutBoundGateway"
    reply-channel="nullChannel" source-address=""
    request-channel="smppOutBoundGatewayChannel">
    <int-smpp:session value="#{headers[smppSession]}"/>
</int-smpp:outbound-gateway>

【问题讨论】:

    标签: spring spring-integration smpp


    【解决方案1】:

    使用使用ThreadLocal 的会话工厂来确定消息使用哪个会话(基于租户)可能更容易 - 将线程设置为适配器的本地上游,使用它来获取/创建会话, 完成后将其删除。

    这不需要对网关本身进行任何更改。

    使用dynamic ftp sample 中的技术可能也更容易实现。

    该机制为每个租户提供一个小的从属上下文和一个动态路由器,用于选择将请求发送到哪一个。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2012-01-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-10-31
      • 2011-01-26
      • 2018-04-15
      相关资源
      最近更新 更多