Class AbstractMongoDbMessageSource<T>
java.lang.Object
org.springframework.integration.util.AbstractExpressionEvaluator
org.springframework.integration.endpoint.AbstractMessageSource<T>
org.springframework.integration.mongodb.inbound.AbstractMongoDbMessageSource<T>
- Type Parameters:
T- The payload type.
- All Implemented Interfaces:
Aware,BeanFactoryAware,BeanNameAware,DisposableBean,InitializingBean,ApplicationContextAware,MessageSource<T>,IntegrationPattern,NamedComponent,IntegrationInboundManagement,IntegrationManagement
- Direct Known Subclasses:
MongoDbMessageSource,ReactiveMongoDbMessageSource
public abstract class AbstractMongoDbMessageSource<T>
extends AbstractMessageSource<T>
implements ApplicationContextAware
An
AbstractMessageSource extension for common MongoDB sources options and support methods.- Since:
- 5.5
- Author:
- Artem Bilan, Ngoc Nhan
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.springframework.integration.support.management.IntegrationManagement
IntegrationManagement.ManagementOverrides -
Field Summary
FieldsFields inherited from class org.springframework.integration.util.AbstractExpressionEvaluator
EXPRESSION_PARSER, loggerFields inherited from interface org.springframework.integration.support.management.IntegrationManagement
METER_PREFIX, RECEIVE_COUNTER_NAME, SEND_TIMER_NAME -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected Stringprotected Queryprotected Updateprotected QuerygetByIdInQuery(Collection<?> entities) Class<?>idForEntity(Object entity) booleanprotected booleanprotected voidonInit()voidsetApplicationContext(ApplicationContext applicationContext) voidsetCollectionNameExpression(Expression collectionNameExpression) Set the SpELExpressionthat should resolve to a collection name used by theQuery.voidsetEntityClass(Class<?> entityClass) Set the type of the entityClass that will be passed to the find MongoDb template operation.voidsetExpectSingleResult(boolean expectSingleResult) Manage which find* method to invoke.protected voidsetInitialized(boolean initialized) voidsetMongoConverter(MongoConverter mongoConverter) Provide a customMongoConverterused to assist in deserialization data read from MongoDb.voidsetUpdateExpression(Expression updateExpression) Specify an optionalupdatefor just polled records from the collection.Methods inherited from class org.springframework.integration.endpoint.AbstractMessageSource
buildMessage, destroy, doReceive, getBeanName, getComponentName, getManagedName, getManagedType, getOverrides, isLoggingEnabled, receive, registerMetricsCaptor, setBeanName, setHeaderExpressions, setLoggingEnabled, setManagedName, setManagedTypeMethods inherited from class org.springframework.integration.util.AbstractExpressionEvaluator
afterPropertiesSet, evaluateExpression, evaluateExpression, evaluateExpression, evaluateExpression, evaluateExpression, evaluateExpression, evaluateExpression, getBeanFactory, getEvaluationContext, getEvaluationContext, getMessageBuilderFactory, setBeanFactory, setConversionService, setSimpleEvaluationContextMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.integration.support.management.IntegrationManagement
getThisAs, isObserved, registerObservationRegistryMethods inherited from interface org.springframework.integration.core.MessageSource
getIntegrationPatternTypeMethods inherited from interface org.springframework.integration.support.context.NamedComponent
getComponentType
-
Field Details
-
queryExpression
-
-
Constructor Details
-
AbstractMongoDbMessageSource
-
-
Method Details
-
setEntityClass
Set the type of the entityClass that will be passed to the find MongoDb template operation. Default isDBObject.- Parameters:
entityClass- The entity class.
-
setExpectSingleResult
public void setExpectSingleResult(boolean expectSingleResult) Manage which find* method to invoke. Default is 'false', which means theAbstractMessageSource.receive()method will use thefind()method. If set to 'true',AbstractMessageSource.receive()will usefindOne(Query, Class), and the payload of the returnedMessagewill be the returned target Object of type identified byentityClassinstead of a List.- Parameters:
expectSingleResult- true if a single result is expected.
-
setCollectionNameExpression
Set the SpELExpressionthat should resolve to a collection name used by theQuery. The resulting collection name will be included in theMongoHeaders.COLLECTION_NAMEheader.- Parameters:
collectionNameExpression- The collection name expression.
-
setMongoConverter
Provide a customMongoConverterused to assist in deserialization data read from MongoDb.- Parameters:
mongoConverter- The mongo converter.
-
setUpdateExpression
Specify an optionalupdatefor just polled records from the collection.- Parameters:
updateExpression- SpEL expression for anUpdateDefinition.- Since:
- 5.5
-
setApplicationContext
- Specified by:
setApplicationContextin interfaceApplicationContextAware- Throws:
BeansException
-
getCollectionNameExpression
-
getMongoConverter
-
getEntityClass
-
isExpectSingleResult
public boolean isExpectSingleResult() -
getUpdateExpression
-
getApplicationContext
-
setInitialized
protected void setInitialized(boolean initialized) -
isInitialized
protected boolean isInitialized() -
onInit
protected void onInit()- Overrides:
onInitin classAbstractExpressionEvaluator
-
evaluateQueryExpression
-
evaluateCollectionNameExpression
-
getByIdInQuery
-
idForEntity
-
evaluateUpdateExpression
-