public class MongoPersistWriter extends Object implements StreamsPersistWriter, Runnable, Flushable, Closeable
| Modifier and Type | Field and Description |
|---|---|
protected com.mongodb.MongoClient |
client |
protected com.mongodb.DBCollection |
collection |
protected com.mongodb.DB |
db |
protected List<com.mongodb.DBObject> |
insertBatch |
protected ReadWriteLock |
lock |
protected Queue<StreamsDatum> |
persistQueue |
static String |
STREAMS_ID |
| Constructor and Description |
|---|
MongoPersistWriter() |
MongoPersistWriter(MongoConfiguration config) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
addToBatch(com.mongodb.DBObject dbObject) |
void |
cleanUp() |
void |
close() |
void |
flush() |
protected void |
flushIfNecessary() |
String |
getId() |
Queue<StreamsDatum> |
getPersistQueue() |
void |
prepare(Object configurationObject) |
protected com.mongodb.DBObject |
prepareObject(StreamsDatum streamsDatum) |
void |
run() |
void |
setPersistQueue(Queue<StreamsDatum> persistQueue) |
void |
start()
start write thread.
|
void |
stop()
stop.
|
void |
write(StreamsDatum streamsDatum) |
public static final String STREAMS_ID
protected volatile Queue<StreamsDatum> persistQueue
protected com.mongodb.MongoClient client
protected com.mongodb.DB db
protected com.mongodb.DBCollection collection
protected List<com.mongodb.DBObject> insertBatch
protected final ReadWriteLock lock
public MongoPersistWriter()
public MongoPersistWriter(MongoConfiguration config)
public void setPersistQueue(Queue<StreamsDatum> persistQueue)
public Queue<StreamsDatum> getPersistQueue()
public String getId()
getId in interface StreamsOperationpublic void write(StreamsDatum streamsDatum)
write in interface StreamsPersistWriterpublic void flush()
throws IOException
flush in interface FlushableIOExceptionpublic void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableIOExceptionpublic void start()
public void stop()
public void prepare(Object configurationObject)
prepare in interface StreamsOperationpublic void cleanUp()
cleanUp in interface StreamsOperationprotected void flushIfNecessary()
protected void addToBatch(com.mongodb.DBObject dbObject)
protected com.mongodb.DBObject prepareObject(StreamsDatum streamsDatum)
Copyright © 2018 The Apache Software Foundation. All rights reserved.