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 StreamsOperation
public void write(StreamsDatum streamsDatum)
write
in interface StreamsPersistWriter
public void flush() throws IOException
flush
in interface Flushable
IOException
public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
IOException
public void start()
public void stop()
public void prepare(Object configurationObject)
prepare
in interface StreamsOperation
public void cleanUp()
cleanUp
in interface StreamsOperation
protected 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.