使用网关的Spring-Integration-TCP

时间:2019-02-05 17:23:19

标签: spring-integration

通过定义池大小,将Task Executor用于多线程。这是正确的选择还是使用异步网关是我必须考虑的事情?我能够使用TaskExecutor发送和接收大量消息。感谢您的帮助!

<int-ip:tcp-connection-factory id="server" type="server" port="6060" using-nio="true" serializer="balhserializer" deserializer="balhserializer" task-executor="tasks"/>
<int-ip:tcp-connection-factory id="client" type="client" port="6080" host="localhost" serializer="balhserializer" deserializer="balhserializer"  task-executor="tasks"/>

<bean id="balhserializer" class="org.springframework.integration.ip.tcp.serializer.ByteArrayLengthHeaderSerializer">
    <constructor-arg name="headerSize"><value>2</value></constructor-arg>
</bean>

<task:executor id="tasks" keep-alive="5" pool-size="10"/>

<!-- <int-ip:tcp-inbound-channel-adapter connection-factory="server" channel="request"/> -->    
<!-- <int-ip:tcp-outbound-channel-adapter connection-factory="client" channel="request">
    <int:poller fixed-delay="1" time-unit="SECONDS"></int:poller>
</int-ip:tcp-outbound-channel-adapter> -->

<int-ip:tcp-inbound-gateway id="tigw" connection-factory="server"  request-channel="request" reply-channel="reply"/>

<int-ip:tcp-outbound-gateway id="togw" connection-factory="client" request-channel="request" reply-channel="reply">
    <int:poller fixed-delay="1" time-unit="MILLISECONDS"></int:poller>
</int-ip:tcp-outbound-gateway>


<int:channel id="request">
    <int:queue capacity="1000"/>
</int:channel>

<int:channel id="reply">
    <int:queue capacity="1000"/>
</int:channel>

<!-- <bean id="mre" class="com.mastercard.iso.lb.MessageReaderEndPoint"/> -->

<!-- <int:service-activator id="sa" input-channel="reply" ref="mre" method="read">
    <int:poller fixed-delay="2" time-unit="SECONDS"/>
</int:service-activator> -->

0 个答案:

没有答案