我想要在客户端轮询一个数据库并通过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)
谢谢我删除了无效的队列容量。 – stacker 2010-06-25 12:54:53
答案是误导性的,但我同意-1是多余的 – iwein 2010-07-20 09:26:26