public class MongoDbStoringMessageHandler extends AbstractMessageHandler
MessageHandler
which writes Message payload into a MongoDb collection
identified by evaluation of the collectionNameExpression
.logger
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
Constructor and Description |
---|
MongoDbStoringMessageHandler(MongoDbFactory mongoDbFactory)
Will construct this instance using provided
MongoDbFactory |
MongoDbStoringMessageHandler(MongoOperations mongoTemplate)
Will construct this instance using fully created and initialized instance of
provided
MongoOperations |
Modifier and Type | Method and Description |
---|---|
String |
getComponentType()
Subclasses may implement this method to provide component type information.
|
protected void |
handleMessageInternal(Message<?> message) |
protected void |
onInit()
Subclasses may implement this for initialization logic.
|
void |
setCollectionNameExpression(Expression collectionNameExpression)
Sets the SpEL
Expression that should resolve to a collection name
used by MongoOperations to store data |
void |
setMongoConverter(MongoConverter mongoConverter)
Allows you to provide custom
MongoConverter used to assist in serialization
of data written to MongoDb. |
getOrder, handleMessage, setOrder, setShouldTrack
afterPropertiesSet, getApplicationContextId, getBeanFactory, getComponentName, getConversionService, getIntegrationProperties, getIntegrationProperty, getMessageBuilderFactory, getTaskScheduler, setApplicationContext, setBeanFactory, setBeanName, setComponentName, setConversionService, setMessageBuilderFactory, setTaskScheduler, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getComponentName
public MongoDbStoringMessageHandler(MongoDbFactory mongoDbFactory)
MongoDbFactory
mongoDbFactory
- The mongodb factory.public MongoDbStoringMessageHandler(MongoOperations mongoTemplate)
MongoOperations
mongoTemplate
- The MongoOperations implementation.public void setMongoConverter(MongoConverter mongoConverter)
MongoConverter
used to assist in serialization
of data written to MongoDb. Only allowed if this instance was constructed with a
MongoDbFactory
.mongoConverter
- The mongo converter.public void setCollectionNameExpression(Expression collectionNameExpression)
Expression
that should resolve to a collection name
used by MongoOperations
to store datacollectionNameExpression
- The collection name expression.public String getComponentType()
IntegrationObjectSupport
getComponentType
in interface NamedComponent
getComponentType
in class AbstractMessageHandler
protected void onInit() throws Exception
IntegrationObjectSupport
onInit
in class IntegrationObjectSupport
Exception
- Any exception.protected void handleMessageInternal(Message<?> message) throws Exception
handleMessageInternal
in class AbstractMessageHandler
Exception