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