Spring Integration provides two adapters for streams. Both ByteStreamReadingMessageSource
and
CharacterStreamReadingMessageSource
implement MessageSource
.
By configuring one of these within a channel-adapter element, the polling period can be configured,
and the Message Bus can automatically detect and schedule them. The byte stream version requires an
InputStream
, and the character stream version requires a Reader
as
the single constructor argument. The ByteStreamReadingMessageSource
also accepts the 'bytesPerMessage'
property to determine how many bytes it will attempt to read into each Message
. The
default value is 1024
<bean class="org.springframework.integration.stream.ByteStreamReadingMessageSource"> <constructor-arg ref="someInputStream"/> <property name="bytesPerMessage" value="2048"/> </bean> <bean class="org.springframework.integration.stream.CharacterStreamReadingMessageSource"> <constructor-arg ref="someReader"/> </bean>