Package com.adaptris.core.mongodb
Class MongoDBAggregateProducer
- java.lang.Object
-
- com.adaptris.core.AdaptrisMessageWorkerImp
-
- com.adaptris.core.AdaptrisMessageProducerImp
-
- com.adaptris.core.RequestReplyProducerBase
-
- com.adaptris.core.RequestReplyProducerImp
-
- com.adaptris.core.mongodb.MongoDBProducer
-
- com.adaptris.core.mongodb.MongoDBRetrieveProducer
-
- com.adaptris.core.mongodb.MongoDBAggregateProducer
-
- All Implemented Interfaces:
AdaptrisComponent
,AdaptrisMessageProducer
,AdaptrisMessageSender
,AdaptrisMessageWorker
,ComponentLifecycle
,ComponentLifecycleExtension
,MessageEventGenerator
@ComponentProfile(summary="Executes aggregate MongoDB queries, results returned as JSON Array.", tag="producer,mongodb", recommended=MongoDBConnection.class) public class MongoDBAggregateProducer extends MongoDBRetrieveProducer
Producer that executes aggregate MongoDB queries, results returned as JSON Array.Example Pipeline:
Returns the count of starsData:
[ { "name" : "Café Con Leche", "stars" : 3, "categories" : ["Bakery", "Coffee", "Pastries"] }, { "name" : "Fred's", "stars" : 1, "categories" : ["Bakery", "Coffee", "Pastries"] } ]
Query:
[{ "$group" : { "_id" : "$stars", "count" : { "$sum" : 1 } } }]
Result:
[ { "_id" : "1", "count" : "1" }, { "_id" : "3", "count" : "1" } ]
In the adapter configuration file this class is aliased as mongodb-aggregate-producer which is the preferred alternative to the fully qualified classname when building your configuration.
-
-
Field Summary
-
Fields inherited from class com.adaptris.core.AdaptrisMessageWorkerImp
log
-
-
Constructor Summary
Constructors Constructor Description MongoDBAggregateProducer()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Boolean
getAllowDiskUse()
DataInputParameter<java.lang.String>
getPipeline()
java.lang.Boolean
getToCollection()
protected com.mongodb.client.MongoIterable<org.bson.Document>
retrieveResults(com.mongodb.client.MongoCollection<org.bson.Document> collection, AdaptrisMessage msg)
void
setAllowDiskUse(java.lang.Boolean allowDiskUse)
void
setPipeline(DataInputParameter<java.lang.String> pipeline)
void
setToCollection(java.lang.Boolean toCollection)
MongoDBAggregateProducer
withPipeline(DataInputParameter<java.lang.String> filter)
-
Methods inherited from class com.adaptris.core.mongodb.MongoDBRetrieveProducer
doRequest, getBatchSize, getJsonOutputSettings, setBatchSize, setJsonOutputSettings
-
Methods inherited from class com.adaptris.core.mongodb.MongoDBProducer
defaultTimeout, doProduce, doRequest, endpoint, getCollection, getMongoClient, getMongoDatabase, init, prepare, setCollection, withCollection
-
Methods inherited from class com.adaptris.core.RequestReplyProducerImp
produce, request, request
-
Methods inherited from class com.adaptris.core.RequestReplyProducerBase
copyReplyContents, getIgnoreReplyMetadata, mergeReply, setIgnoreReplyMetadata
-
Methods inherited from class com.adaptris.core.AdaptrisMessageProducerImp
createName
-
Methods inherited from class com.adaptris.core.AdaptrisMessageWorkerImp
createQualifier, decode, encode, getEncoder, getIsTrackingEndpoint, getMessageFactory, getUniqueId, handleConnectionException, isTrackingEndpoint, registerConnection, registerEncoderMessageFactory, retrieveConnection, setEncoder, setIsTrackingEndpoint, setMessageFactory, setUniqueId, withMessageFactory, withUniqueID
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.adaptris.core.AdaptrisComponent
getUniqueId
-
Methods inherited from interface com.adaptris.core.AdaptrisMessageWorker
decode, encode, getEncoder, getMessageFactory, handleConnectionException, registerConnection, retrieveConnection, setEncoder, setMessageFactory
-
Methods inherited from interface com.adaptris.core.ComponentLifecycle
close, start, stop
-
Methods inherited from interface com.adaptris.core.MessageEventGenerator
createQualifier, isTrackingEndpoint
-
-
-
-
Method Detail
-
retrieveResults
protected com.mongodb.client.MongoIterable<org.bson.Document> retrieveResults(com.mongodb.client.MongoCollection<org.bson.Document> collection, AdaptrisMessage msg) throws InterlokException
- Specified by:
retrieveResults
in classMongoDBRetrieveProducer
- Throws:
InterlokException
-
getPipeline
public DataInputParameter<java.lang.String> getPipeline()
-
setPipeline
public void setPipeline(DataInputParameter<java.lang.String> pipeline)
-
getAllowDiskUse
public java.lang.Boolean getAllowDiskUse()
-
setAllowDiskUse
public void setAllowDiskUse(java.lang.Boolean allowDiskUse)
-
getToCollection
public java.lang.Boolean getToCollection()
-
setToCollection
public void setToCollection(java.lang.Boolean toCollection)
-
withPipeline
public MongoDBAggregateProducer withPipeline(DataInputParameter<java.lang.String> filter)
-
-