use of org.talend.components.salesforce.tsalesforcebulkexec.TSalesforceBulkExecProperties in project components by Talend.
the class SalesforceBulkExecReader method start.
@Override
public boolean start() throws IOException {
TSalesforceBulkExecProperties sprops = (TSalesforceBulkExecProperties) properties;
bulkRuntime = new SalesforceBulkRuntime(((SalesforceSource) getCurrentSource()).connect(container).bulkConnection);
bulkRuntime.setConcurrencyMode(sprops.bulkProperties.concurrencyMode.getValue());
bulkRuntime.setAwaitTime(sprops.bulkProperties.waitTimeCheckBatchState.getValue());
try {
// We only support CSV file for bulk output
bulkRuntime.executeBulk(sprops.module.moduleName.getStringValue(), sprops.outputAction.getValue(), sprops.upsertKeyColumn.getStringValue(), "csv", sprops.bulkFilePath.getStringValue(), sprops.bulkProperties.bytesToCommit.getValue(), sprops.bulkProperties.rowsToCommit.getValue());
if (bulkRuntime.getBatchCount() > 0) {
batchIndex = 0;
currentBatchResult = bulkRuntime.getBatchLog(0);
resultIndex = 0;
boolean startable = currentBatchResult.size() > 0;
if (startable) {
countData();
}
return startable;
}
return false;
} catch (AsyncApiException | ConnectionException e) {
throw new IOException(e);
}
}
use of org.talend.components.salesforce.tsalesforcebulkexec.TSalesforceBulkExecProperties in project components by Talend.
the class SalesforceSource method createReader.
@Override
public BoundedReader createReader(RuntimeContainer adaptor) {
if (properties instanceof TSalesforceInputProperties) {
TSalesforceInputProperties sfInProperties = (TSalesforceInputProperties) properties;
boolean isBulk = TSalesforceInputProperties.QueryMode.Bulk.equals(sfInProperties.queryMode.getValue());
sfInProperties.connection.bulkConnection.setValue(isBulk);
if (isBulk) {
return new SalesforceBulkQueryInputReader(adaptor, this, sfInProperties);
} else {
return new SalesforceInputReader(adaptor, this, sfInProperties);
}
} else if (properties instanceof TSalesforceGetServerTimestampProperties) {
return new SalesforceServerTimeStampReader(adaptor, this, (TSalesforceGetServerTimestampProperties) properties);
} else if (properties instanceof TSalesforceGetDeletedProperties) {
return new SalesforceGetDeletedReader(adaptor, this, (TSalesforceGetDeletedProperties) properties);
} else if (properties instanceof TSalesforceGetUpdatedProperties) {
return new SalesforceGetUpdatedReader(adaptor, this, (TSalesforceGetUpdatedProperties) properties);
} else if (properties instanceof TSalesforceBulkExecProperties) {
((TSalesforceBulkExecProperties) properties).connection.bulkConnection.setValue(true);
return new SalesforceBulkExecReader(adaptor, this, (TSalesforceBulkExecProperties) properties);
}
return null;
}
Aggregations