public class MongoWriter extends IntegrationWriter
DataEndpoint.StatelastRecord, PRODUCT, PRODUCT_VERSION, VENDOR, XML_INPUT_FACTORY_KEYBUFFER_SIZE, captureElapsedTime, DEFAULT_READ_BUFFER_SIZEid, log, name, TIMESTAMP_FORMAT| Constructor and Description |
|---|
MongoWriter(MongoClient client,
String database,
String collection)
Connects to the MongoDB server as specified in MongoClient.
|
MongoWriter(String database,
String collection)
Connects to the MongoDB server in localhost on the default port 27017.
|
| Modifier and Type | Method and Description |
|---|---|
DataException |
addExceptionProperties(DataException exception)
Adds this endpoint's current state to a
DataException. |
void |
close()
Indicates that this endpoint has finished reading or writing.
|
int |
getBatchSize() |
boolean |
isAutoCloseConnection()
Indicates if the MongoDB client should be closed when this writer closes (defaults to false).
|
boolean |
isBatchMode() |
void |
open()
Makes this endpoint ready for reading or writing.
|
MongoWriter |
setAutoCloseConnection(boolean closeConnection)
Indicates if the MongoDB client should be closed when this writer closes (defaults to false).
|
MongoWriter |
setBatchSize(int size)
Sets the number of records to chunk together in batch updates.
|
protected void |
writeImpl(Record record)
Overridden by subclasses to write the specified record to this
DataWriter. |
available, getNestedEndpoint, getNestedWriter, getRootEndpoint, getRootWriter, getWriter, writedecrementRecordCount, enableJmx, getLastRecord, getRecordCount, getRecordCountAsBigInteger, getRecordCountAsString, incrementRecordCount, isRecordCountBigInteger, resetRecordCount, toStringaddElapsedtime, assertClosed, assertNotOpened, assertOpened, finalize, getClosedOn, getDescription, getElapsedTime, getElapsedTimeAsString, getOpenedOn, getOpenElapsedTime, getOpenElapsedTimeAsString, getSelfTime, getSelfTimeAsString, getState, isCaptureElapsedTime, isClosed, isOpen, setCaptureElapsedTime, setDescriptionpublic MongoWriter(String database, String collection)
database - name of the database to be used.collection - name of the collection to be used.public MongoWriter(MongoClient client,
String database,
String collection)
client - the MongoClient instance.database - name of the database to be used.collection - name of the collection to be used.public MongoWriter setBatchSize(int size)
size - the number of records to chunk together.public int getBatchSize()
public boolean isBatchMode()
protected void writeImpl(Record record) throws Throwable
DataWriterDataWriter.writeImpl in class DataWriterThrowablepublic boolean isAutoCloseConnection()
public MongoWriter setAutoCloseConnection(boolean closeConnection)
public void open()
throws DataException
DataEndpointopen in class IntegrationWriterDataExceptionpublic void close()
throws DataException
DataEndpointclose in class DataEndpointDataExceptionpublic DataException addExceptionProperties(DataException exception)
EndpointDataException. Since this method is called whenever an
exception is thrown, subclasses should override it to add their specific information.addExceptionProperties in class DataWriterCopyright (c) 2006-2025 North Concepts Inc. All Rights Reserved.