[英]Does spring integration's tcp-inbound-channel-adapter and tcp-connection-factory have failover support?
我有一個簡單的 tcp 客戶端,它使用 spring 集成來接收消息,並將其寫入文件。
我希望客戶端默認連接到thing.input.primary.host,但是在連接失敗的情況下,我希望它重新連接到thing.input.secondary.host,然后像往常一樣發送消息; spring 集成是否支持此行為?
編輯:為清楚起見。 如果thingClient 失敗,我想做的是讓它從thingClient 切換到thingClientSecondary。
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:int="http://www.springframework.org/schema/integration"
xmlns:int-ip="http://www.springframework.org/schema/integration/ip"
xmlns:int-file="http://www.springframework.org/schema/integration/file"
xmlns="http://www.springframework.org/schema/beans"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration.xsd
http://www.springframework.org/schema/integration/ip http://www.springframework.org/schema/integration/ip/spring-integration-ip.xsd
http://www.springframework.org/schema/integration/file http://www.springframework.org/schema/integration/file/spring-integration-file.xsd">
<int-ip:tcp-inbound-channel-adapter
id="thingInGateway"
connection-factory="thingClientPrimary"
channel="fileOutputChain"
client-mode="true"
auto-startup="true"
retry-interval="1000"/>
<int-ip:tcp-connection-factory
id="thingClientPrimary"
type="client"
host="${thing.input.primary.host}"
port="${thing.input.primary.port}"
deserializer="thingSerializer"
serializer="thingSerializer"
socket-support="thingSocketSupport"
so-keep-alive="true"
using-nio="true"/>
<int-ip:tcp-connection-factory
id="thingClientSecondary"
type="client"
host="${thing.input.secondary.host}"
port="${thing.input.secondary.port}"
deserializer="thingSerializer"
serializer="thingSerializer"
socket-support="thingSocketSupport"
so-keep-alive="true"
using-nio="true"/>
<int:chain input-channel="fileOutputChain" >
<int-file:outbound-channel-adapter directory="${thing.output.directory}"/>
</int:chain>
</beans>
不; 只需定義使用另一個工廠和相同通道的第二個通道適配器; 那么任何一個端口上的任何數據都會 go 到同一個地方。
“故障轉移”在服務器端是一個不尋常的術語。 通常,當服務器連接丟失時,客戶端會進行故障轉移。
在服務器端,我們是被動的,術語“故障轉移”在這里毫無意義。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.