org.springframework.integration.mongodb.outbound
Class MongoDbStoringMessageHandler
java.lang.Object
org.springframework.integration.context.IntegrationObjectSupport
org.springframework.integration.handler.AbstractMessageHandler
org.springframework.integration.mongodb.outbound.MongoDbStoringMessageHandler
- All Implemented Interfaces:
- org.springframework.beans.factory.Aware, org.springframework.beans.factory.BeanFactoryAware, org.springframework.beans.factory.BeanNameAware, org.springframework.beans.factory.InitializingBean, org.springframework.core.Ordered, NamedComponent, Orderable, MessageHandler, TrackableComponent
public class MongoDbStoringMessageHandler
- extends AbstractMessageHandler
Implementation of MessageHandler
which writes Message payload into a MongoDb collection
identified by evaluation of the collectionNameExpression
.
- Since:
- 2.2
- Author:
- Amol Nayak, Oleg Zhurakousky
Fields inherited from interface org.springframework.core.Ordered |
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE |
Constructor Summary |
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 |
Method Summary |
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. |
Methods inherited from class org.springframework.integration.context.IntegrationObjectSupport |
afterPropertiesSet, getBeanFactory, getComponentName, getConversionService, getTaskScheduler, setBeanFactory, setBeanName, setComponentName, setConversionService, setTaskScheduler, toString |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
MongoDbStoringMessageHandler
public MongoDbStoringMessageHandler(org.springframework.data.mongodb.MongoDbFactory mongoDbFactory)
- Will construct this instance using provided
MongoDbFactory
- Parameters:
mongoDbFactory
-
MongoDbStoringMessageHandler
public MongoDbStoringMessageHandler(org.springframework.data.mongodb.core.MongoOperations mongoTemplate)
- Will construct this instance using fully created and initialized instance of
provided
MongoOperations
- Parameters:
mongoTemplate
-
setMongoConverter
public 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. Only allowed if this instance was constructed with a
MongoDbFactory
.
- Parameters:
mongoConverter
-
setCollectionNameExpression
public void setCollectionNameExpression(org.springframework.expression.Expression collectionNameExpression)
- Sets the SpEL
Expression
that should resolve to a collection name
used by MongoOperations
to store data
- Parameters:
collectionNameExpression
-
onInit
protected void onInit()
throws java.lang.Exception
- Description copied from class:
IntegrationObjectSupport
- Subclasses may implement this for initialization logic.
- Overrides:
onInit
in class IntegrationObjectSupport
- Throws:
java.lang.Exception
handleMessageInternal
protected void handleMessageInternal(Message<?> message)
throws java.lang.Exception
- Specified by:
handleMessageInternal
in class AbstractMessageHandler
- Throws:
java.lang.Exception