I have a spring integration application that has a pub-sub channel with two subscribers - one publishes the message to Kafka and the other writes the message to a file. The problem is that the service-activator that writes the message to the file is not able to keep up with the speed of the other service-activator that produces to Kafka. This causes a slow down in the overall message processing rate. To overcome this, I have added an extra layer in between the pub-sub channel and the service-activator that writes to file. A transformer, the does nothing but consumes the message and puts the messages into a direct channel which is consumed by the filewriter. This has improved performance in my case but I was wondering if this is the right way to do? Sample configuration below:
<int:publish-subscribe-channel id="pschannel"/>
<int:service-activator id="kafkaSA" ref="producer" input- channel="pschannel" method="publish"/>
<int:transformer input-channel="pschannel" ref="dummytransformer" method="doNothing" output-channel="directChannel"/>
<bean id="dummytransformer" class="org.test.DummyTransformer"/>
<int:channel id="directChannel">
<int:queue capacity="200000" />
<int:channel>
<int:service-activator id="fileSA" ref="filewriter" input-channel="directChannel" method="publish" >
<int:poller max-messages-per-poll="10000" fixed-delay="100" />
</int:service-activator>