我正在尝试在客户端轮询数据库并通过 HTTP 将结果发送到收集数据的服务器。不幸的是,只有第一条消息被传递。我是弹簧集成的新手(1.0.3)
我的配置有什么问题?
客户端配置:
<si:channel id="msgChannel">
<si:queue capacity="1" />
</si:channel>
<si:inbound-channel-adapter ref="jdbcInputAdapter" method="fetchData" channel="msgChannel">
<si:poller max-messages-per-poll="1">
<si:interval-trigger interval="5000" />
</si:poller>
</si:inbound-channel-adapter>
<http:outbound-gateway id="httpChannelAdapter" request-channel="msgChannel" default-url="http://localhost:8080/company/gateway"/>
<si:poller default="true">
<si:interval-trigger interval="5000" />
</si:poller>
服务器配置:
<si:channel id="requestChannel">
<si:queue capacity="4" />
</si:channel>
<si:channel id="replyChannel" />
<http:inbound-gateway id="InboundGateway" request-channel="requestChannel" reply-channel="replyChannel"/>
<bean id="shouter" class="com.company.Shouter"/>
<si:outbound-channel-adapter ref="shouter" method="shout" channel="replyChannel"/>
<si:service-activator input-channel="requestChannel"
ref="StorageService" method="store"
output-channel="replyChannel" />
<bean id="StorageService" class="com.company.StorageService" />
<si:poller default="true">
<si:interval-trigger interval="1000" />
</si:poller>
编辑:每次我重新启动客户端时,服务器都会收到一条消息。
已解决:我不得不将 StorageService 的签名从
public void store(Message msg)
到
public Message store(Message msg)