Class MongoDbOutboundGatewaySpec
java.lang.Object
org.springframework.integration.dsl.IntegrationComponentSpec<S,H>
org.springframework.integration.dsl.MessageHandlerSpec<MongoDbOutboundGatewaySpec,MongoDbOutboundGateway>
org.springframework.integration.mongodb.dsl.MongoDbOutboundGatewaySpec
- All Implemented Interfaces:
DisposableBean
,FactoryBean<MongoDbOutboundGateway>
,InitializingBean
,Lifecycle
,Phased
,SmartLifecycle
public class MongoDbOutboundGatewaySpec
extends MessageHandlerSpec<MongoDbOutboundGatewaySpec,MongoDbOutboundGateway>
A
MessageHandlerSpec
extension for the MongoDb Outbound endpoint MongoDbOutboundGateway
.- Since:
- 5.0
- Author:
- Xavier Padro, Artem Bilan
-
Field Summary
Fields inherited from class org.springframework.integration.dsl.IntegrationComponentSpec
logger, PARSER, target
Fields inherited from interface org.springframework.beans.factory.FactoryBean
OBJECT_TYPE_ATTRIBUTE
Fields inherited from interface org.springframework.context.SmartLifecycle
DEFAULT_PHASE
-
Constructor Summary
ModifierConstructorDescriptionprotected
MongoDbOutboundGatewaySpec
(MongoOperations mongoTemplate) protected
MongoDbOutboundGatewaySpec
(MongoDatabaseFactory mongoDbFactory, MongoConverter mongoConverter) -
Method Summary
Modifier and TypeMethodDescriptioncollectionCallback
(MessageCollectionCallback<P> collectionCallback) Reference to an instance ofMessageCollectionCallback
which specifies the database operation to execute in the request message context.collectionName
(String collectionName) Identify the name of the MongoDb collection to use.collectionNameExpression
(String collectionNameExpression) A SpEL expression which should resolve to aString
value identifying the name of the MongoDb collection to use.collectionNameFunction
(Function<Message<P>, String> collectionNameFunction) entityClass
(Class<?> entityClass) The fully qualified name of the entity class to be passed tofind(..)
orfindOne(..)
method inMongoOperations
.expectSingleResult
(boolean expectSingleResult) This parameter indicates that only one result object will be returned from the database by using afindOne
query.AString
representation of a MongoDbQuery
(e.g., query("{'name' : 'Bob'}")).queryExpression
(String queryExpression) A SpEL expression which should resolve to aString
query (please refer to the 'query' property), or to an instance of MongoDbQuery
(e.q., queryExpression("new BasicQuery('{''address.state'' : ''PA''}')")).queryFunction
(Function<Message<P>, Query> queryFunction) Methods inherited from class org.springframework.integration.dsl.IntegrationComponentSpec
_this, afterPropertiesSet, destroy, doGet, get, getId, getObject, getObjectType, getPhase, id, isAutoStartup, isRunning, start, stop, stop
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.springframework.beans.factory.FactoryBean
isSingleton
-
Constructor Details
-
MongoDbOutboundGatewaySpec
protected MongoDbOutboundGatewaySpec(MongoDatabaseFactory mongoDbFactory, MongoConverter mongoConverter) -
MongoDbOutboundGatewaySpec
-
-
Method Details
-
expectSingleResult
This parameter indicates that only one result object will be returned from the database by using afindOne
query. If set tofalse
(default), the complete result list is returned as the payload.- Parameters:
expectSingleResult
- theboolean
flag to indicate if a single result is returned or not.- Returns:
- the spec
-
query
AString
representation of a MongoDbQuery
(e.g., query("{'name' : 'Bob'}")). Please refer to MongoDb documentation for more query samples see MongoDB Docs This property is mutually exclusive with 'queryExpression' property.- Parameters:
query
- the MongoDbQuery
string representation to use.- Returns:
- the spec
-
queryExpression
A SpEL expression which should resolve to aString
query (please refer to the 'query' property), or to an instance of MongoDbQuery
(e.q., queryExpression("new BasicQuery('{''address.state'' : ''PA''}')")).- Parameters:
queryExpression
- the SpEL expression query to use.- Returns:
- the spec
-
queryFunction
- Type Parameters:
P
- the type of the message payload.- Parameters:
queryFunction
- theFunction
to use.- Returns:
- the spec
-
entityClass
The fully qualified name of the entity class to be passed tofind(..)
orfindOne(..)
method inMongoOperations
. If this attribute is not provided the default value isDocument
.- Parameters:
entityClass
- theClass
to use.- Returns:
- the spec
-
collectionName
Identify the name of the MongoDb collection to use. This attribute is mutually exclusive withcollectionNameExpression(java.lang.String)
property.- Parameters:
collectionName
- theString
specifying the MongoDb collection.- Returns:
- the spec
-
collectionNameExpression
A SpEL expression which should resolve to aString
value identifying the name of the MongoDb collection to use. This property is mutually exclusive withcollectionName(java.lang.String)
property.- Parameters:
collectionNameExpression
- theString
expression to use.- Returns:
- the spec
-
collectionNameFunction
public <P> MongoDbOutboundGatewaySpec collectionNameFunction(Function<Message<P>, String> collectionNameFunction) - Type Parameters:
P
- the type of the message payload.- Parameters:
collectionNameFunction
- theFunction
to use.- Returns:
- the spec
-
collectionCallback
public <P> MongoDbOutboundGatewaySpec collectionCallback(MessageCollectionCallback<P> collectionCallback) Reference to an instance ofMessageCollectionCallback
which specifies the database operation to execute in the request message context. This property is mutually exclusive withquery(java.lang.String)
andqueryExpression(java.lang.String)
properties.- Type Parameters:
P
- the type of the message payload.- Parameters:
collectionCallback
- theMessageCollectionCallback
instance- Returns:
- the spec
- Since:
- 5.0.11
-