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:
org.springframework.beans.factory.DisposableBean,org.springframework.beans.factory.FactoryBean<MongoDbOutboundGateway>,org.springframework.beans.factory.InitializingBean,org.springframework.context.Lifecycle,org.springframework.context.Phased,org.springframework.context.SmartLifecycle
public class MongoDbOutboundGatewaySpec
extends org.springframework.integration.dsl.MessageHandlerSpec<MongoDbOutboundGatewaySpec,MongoDbOutboundGateway>
A
MessageHandlerSpec extension for the MongoDb Outbound endpoint MongoDbOutboundGateway.- Since:
- 5.0
-
Field Summary
Fields inherited from class org.springframework.integration.dsl.IntegrationComponentSpec
logger, PARSER, targetFields inherited from interface org.springframework.beans.factory.FactoryBean
OBJECT_TYPE_ATTRIBUTEFields inherited from interface org.springframework.context.SmartLifecycle
DEFAULT_PHASE -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedMongoDbOutboundGatewaySpec(org.springframework.data.mongodb.core.MongoOperations mongoTemplate) protectedMongoDbOutboundGatewaySpec(org.springframework.data.mongodb.MongoDatabaseFactory mongoDbFactory, org.springframework.data.mongodb.core.convert.MongoConverter mongoConverter) -
Method Summary
Modifier and TypeMethodDescriptioncollectionCallback(MessageCollectionCallback<P> collectionCallback) Reference to an instance ofMessageCollectionCallbackwhich 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 aStringvalue identifying the name of the MongoDb collection to use.collectionNameFunction(Function<org.springframework.messaging.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 afindOnequery.AStringrepresentation of a MongoDbQuery(e.g., query("{'name' : 'Bob'}")).queryExpression(String queryExpression) A SpEL expression which should resolve to aStringquery (please refer to the 'query' property), or to an instance of MongoDbQuery(e.q., queryExpression("new BasicQuery('{''address.state'' : ''PA''}')")).queryFunction(Function<org.springframework.messaging.Message<P>, org.springframework.data.mongodb.core.query.Query> queryFunction) AFunctionwhich should resolve to aQueryinstance.Methods inherited from class org.springframework.integration.dsl.IntegrationComponentSpec
_this, afterPropertiesSet, destroy, doGet, getId, getObject, getObjectType, getPhase, id, isAutoStartup, isRunning, start, stop, stopMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.beans.factory.FactoryBean
isSingleton
-
Constructor Details
-
MongoDbOutboundGatewaySpec
protected MongoDbOutboundGatewaySpec(org.springframework.data.mongodb.MongoDatabaseFactory mongoDbFactory, org.springframework.data.mongodb.core.convert.MongoConverter mongoConverter) -
MongoDbOutboundGatewaySpec
protected MongoDbOutboundGatewaySpec(org.springframework.data.mongodb.core.MongoOperations mongoTemplate)
-
-
Method Details
-
expectSingleResult
This parameter indicates that only one result object will be returned from the database by using afindOnequery. If set tofalse(default), the complete result list is returned as the payload.- Parameters:
expectSingleResult- thebooleanflag to indicate if a single result is returned or not.- Returns:
- the spec
-
query
AStringrepresentation 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 MongoDbQuerystring representation to use.- Returns:
- the spec
-
queryExpression
A SpEL expression which should resolve to aStringquery (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
public <P> MongoDbOutboundGatewaySpec queryFunction(Function<org.springframework.messaging.Message<P>, org.springframework.data.mongodb.core.query.Query> queryFunction) AFunctionwhich should resolve to aQueryinstance.- Type Parameters:
P- the type of the message payload.- Parameters:
queryFunction- theFunctionto 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- theClassto 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- theStringspecifying the MongoDb collection.- Returns:
- the spec
-
collectionNameExpression
A SpEL expression which should resolve to aStringvalue identifying the name of the MongoDb collection to use. This property is mutually exclusive withcollectionName(java.lang.String)property.- Parameters:
collectionNameExpression- theStringexpression to use.- Returns:
- the spec
-
collectionNameFunction
public <P> MongoDbOutboundGatewaySpec collectionNameFunction(Function<org.springframework.messaging.Message<P>, String> collectionNameFunction) - Type Parameters:
P- the type of the message payload.- Parameters:
collectionNameFunction- theFunctionto use.- Returns:
- the spec
-
collectionCallback
public <P> MongoDbOutboundGatewaySpec collectionCallback(MessageCollectionCallback<P> collectionCallback) Reference to an instance ofMessageCollectionCallbackwhich 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- theMessageCollectionCallbackinstance- Returns:
- the spec
- Since:
- 5.0.11
-