Class CharacterStreamReadingMessageSource
java.lang.Object
org.springframework.integration.util.AbstractExpressionEvaluator
org.springframework.integration.endpoint.AbstractMessageSource<String>
org.springframework.integration.stream.inbound.CharacterStreamReadingMessageSource
- All Implemented Interfaces:
Aware,BeanFactoryAware,BeanNameAware,DisposableBean,InitializingBean,ApplicationEventPublisherAware,MessageSource<String>,IntegrationPattern,NamedComponent,IntegrationInboundManagement,IntegrationManagement
- Direct Known Subclasses:
CharacterStreamReadingMessageSource
public class CharacterStreamReadingMessageSource
extends AbstractMessageSource<String>
implements ApplicationEventPublisherAware
A pollable source for
Readers.- Since:
- 7.0
- Author:
- Mark Fisher, Gary Russell, Artem Bilan, Christian Tzolov, Ngoc Nhan
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.springframework.integration.support.management.IntegrationManagement
IntegrationManagement.ManagementOverrides -
Field Summary
Fields inherited from class org.springframework.integration.util.AbstractExpressionEvaluator
EXPRESSION_PARSER, loggerFields inherited from interface org.springframework.integration.support.management.IntegrationManagement
METER_PREFIX, RECEIVE_COUNTER_NAME, SEND_TIMER_NAME -
Constructor Summary
ConstructorsConstructorDescriptionConstruct an instance with the provider reader.CharacterStreamReadingMessageSource(Reader reader, int bufferSize) Construct an instance with the provider reader and buffer size.CharacterStreamReadingMessageSource(Reader reader, int bufferSize, boolean blockToDetectEOF) Construct an instance with the provided reader and buffer size. -
Method Summary
Modifier and TypeMethodDescription@Nullable StringSubclasses must implement this method.voidsetApplicationEventPublisher(ApplicationEventPublisher applicationEventPublisher) stdin()Create a source that reads fromSystem.in.Create a source that reads fromSystem.in.Create a source that reads fromSystem.in.Create a source that reads fromSystem.in.Methods inherited from class org.springframework.integration.endpoint.AbstractMessageSource
buildMessage, destroy, getComponentName, getManagedName, getManagedType, getOverrides, isLoggingEnabled, receive, registerMetricsCaptor, setBeanName, setHeaderExpressions, setLoggingEnabled, setManagedName, setManagedTypeMethods inherited from class org.springframework.integration.util.AbstractExpressionEvaluator
afterPropertiesSet, evaluateExpression, evaluateExpression, evaluateExpression, evaluateExpression, evaluateExpression, evaluateExpression, evaluateExpression, getBeanFactory, getEvaluationContext, getEvaluationContext, getMessageBuilderFactory, onInit, setBeanFactory, setConversionService, setSimpleEvaluationContextMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.integration.support.management.IntegrationManagement
getThisAs, isObserved, registerObservationRegistryMethods inherited from interface org.springframework.integration.core.MessageSource
getIntegrationPatternTypeMethods inherited from interface org.springframework.integration.support.context.NamedComponent
getBeanName
-
Constructor Details
-
CharacterStreamReadingMessageSource
Construct an instance with the provider reader.AbstractMessageSource.receive()will returnnullwhen the reader is not ready.- Parameters:
reader- the reader.
-
CharacterStreamReadingMessageSource
Construct an instance with the provider reader and buffer size.AbstractMessageSource.receive()will returnnullwhen the reader is not ready.- Parameters:
reader- the reader.bufferSize- the buffer size.
-
CharacterStreamReadingMessageSource
Construct an instance with the provided reader and buffer size. WhenblockToDetectEOFisfalse,AbstractMessageSource.receive()will returnnullwhen the reader is not ready. When it istrue, the thread will block until data is available; when the underlying stream is closed, aStreamClosedEventis published to inform the application via anApplicationListener. This can be useful, for example, when piping stdincat foo.txt | java -jar my.jarorjava -jar my.jar < foo.txt- Parameters:
reader- the reader.bufferSize- the buffer size; if negative use the default inBufferedReader.blockToDetectEOF- true to block the thread until data is available and publish aStreamClosedEventat EOF.
-
-
Method Details
-
setApplicationEventPublisher
- Specified by:
setApplicationEventPublisherin interfaceApplicationEventPublisherAware
-
getComponentType
- Specified by:
getComponentTypein interfaceNamedComponent
-
doReceive
Description copied from class:AbstractMessageSourceSubclasses must implement this method. Typically, the returned value will be thepayloadof type T, but the returned value may also be aMessageinstance whose payload is of type T; also can beAbstractIntegrationMessageBuilderwhich is used for additional headers population.- Specified by:
doReceivein classAbstractMessageSource<String>- Returns:
- The value returned.
-
stdin
Create a source that reads fromSystem.in. EOF will not be detected.- Returns:
- the stream.
-
stdin
Create a source that reads fromSystem.in. EOF will not be detected.- Parameters:
charsetName- the charset to use when converting bytes to String.- Returns:
- the stream.
-
stdinPipe
Create a source that reads fromSystem.in. EOF will be detected and the application context closed.- Returns:
- the stream.
- Since:
- 5.0
- See Also:
-
stdinPipe
Create a source that reads fromSystem.in. EOF will be detected and the application context closed.- Parameters:
charsetName- the charset to use when converting bytes to String.- Returns:
- the stream.
- Since:
- 5.0
- See Also:
-