public class MongoDbStoringMessageHandler
extends org.springframework.integration.handler.AbstractMessageHandler
MessageHandler
which writes Message payload into a MongoDb collection
identified by evaluation of the collectionNameExpression
.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 |
---|---|
java.lang.String |
getComponentType() |
protected void |
handleMessageInternal(org.springframework.messaging.Message<?> message) |
protected void |
onInit() |
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. |
getOrder, handleMessage, setOrder, setShouldTrack
afterPropertiesSet, getApplicationContext, getApplicationContextId, getBeanFactory, getComponentName, getConversionService, getIntegrationProperties, getIntegrationProperty, getMessageBuilderFactory, getTaskScheduler, setApplicationContext, setBeanFactory, setBeanName, setComponentName, setConversionService, setMessageBuilderFactory, setTaskScheduler, toString
public MongoDbStoringMessageHandler(org.springframework.data.mongodb.MongoDbFactory mongoDbFactory)
MongoDbFactory
mongoDbFactory
- The mongodb factory.public MongoDbStoringMessageHandler(org.springframework.data.mongodb.core.MongoOperations mongoTemplate)
MongoOperations
mongoTemplate
- The MongoOperations implementation.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
- The mongo converter.public void setCollectionNameExpression(org.springframework.expression.Expression collectionNameExpression)
Expression
that should resolve to a collection name
used by MongoOperations
to store datacollectionNameExpression
- The collection name expression.public java.lang.String getComponentType()
getComponentType
in interface org.springframework.integration.support.context.NamedComponent
getComponentType
in class org.springframework.integration.handler.AbstractMessageHandler
protected void onInit() throws java.lang.Exception
onInit
in class org.springframework.integration.context.IntegrationObjectSupport
java.lang.Exception
protected void handleMessageInternal(org.springframework.messaging.Message<?> message) throws java.lang.Exception
handleMessageInternal
in class org.springframework.integration.handler.AbstractMessageHandler
java.lang.Exception