public class CharacterStreamWritingMessageHandler extends AbstractMessageHandler
MessageHandler
that writes characters to a Writer
.
String, character array, and byte array payloads will be written directly,
but for other payload types, the result of the object's IntegrationObjectSupport.toString()
method will be written. To append a new-line after each write, set the
shouldAppendNewLine
flag to 'true'. It is 'false' by default.IntegrationManagement.ManagementOverrides
EXPRESSION_PARSER, logger
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
METER_PREFIX, RECEIVE_COUNTER_NAME, SEND_TIMER_NAME
Constructor and Description |
---|
CharacterStreamWritingMessageHandler(Writer writer) |
CharacterStreamWritingMessageHandler(Writer writer,
int bufferSize) |
Modifier and Type | Method and Description |
---|---|
CharacterStreamWritingMessageHandler |
appendNewLine(boolean append)
Fluent api for
setShouldAppendNewLine(boolean) . |
String |
getComponentType()
Subclasses may implement this method to provide component type information.
|
protected void |
handleMessageInternal(Message<?> message) |
void |
setShouldAppendNewLine(boolean shouldAppendNewLine) |
static CharacterStreamWritingMessageHandler |
stderr()
Factory method that creates a target for stderr (System.err) with the
default charset encoding.
|
static CharacterStreamWritingMessageHandler |
stderr(String charsetName)
Factory method that creates a target for stderr (System.err) with the
specified charset encoding.
|
static CharacterStreamWritingMessageHandler |
stdout()
Factory method that creates a target for stdout (System.out) with the
default charset encoding.
|
static CharacterStreamWritingMessageHandler |
stdout(String charsetName)
Factory method that creates a target for stdout (System.out) with the
specified charset encoding.
|
handleMessage, onComplete, onError, onNext, onSubscribe
buildSendTimer, destroy, getIntegrationPatternType, getManagedName, getManagedType, getMetricsCaptor, getOrder, getOverrides, isLoggingEnabled, registerMetricsCaptor, sendTimer, setLoggingEnabled, setManagedName, setManagedType, setOrder, setShouldTrack, shouldTrack
afterPropertiesSet, extractTypeIfPossible, generateId, getApplicationContext, getApplicationContextId, getBeanDescription, getBeanFactory, getBeanName, getChannelResolver, getComponentName, getConversionService, getExpression, getIntegrationProperties, getIntegrationProperty, getMessageBuilderFactory, getTaskScheduler, isInitialized, onInit, setApplicationContext, setBeanFactory, setBeanName, setChannelResolver, setComponentName, setConversionService, setMessageBuilderFactory, setPrimaryExpression, setTaskScheduler, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getThisAs
getBeanName, getComponentName
public CharacterStreamWritingMessageHandler(Writer writer)
public CharacterStreamWritingMessageHandler(Writer writer, int bufferSize)
public static CharacterStreamWritingMessageHandler stdout()
public static CharacterStreamWritingMessageHandler stdout(String charsetName)
charsetName
- The charset name.public static CharacterStreamWritingMessageHandler stderr()
public static CharacterStreamWritingMessageHandler stderr(String charsetName)
charsetName
- The charset name.public void setShouldAppendNewLine(boolean shouldAppendNewLine)
public CharacterStreamWritingMessageHandler appendNewLine(boolean append)
setShouldAppendNewLine(boolean)
.append
- true to append a newline.public String getComponentType()
IntegrationObjectSupport
getComponentType
in interface NamedComponent
getComponentType
in class MessageHandlerSupport
protected void handleMessageInternal(Message<?> message)
handleMessageInternal
in class AbstractMessageHandler