use of com.microsoft.azure.storage.table.TableBatchOperation in project components by Talend.
the class AzureStorageTableWriter method processBatch.
private void processBatch() throws IOException {
TableBatchOperation batch = new TableBatchOperation();
batch.addAll(batchOperations);
//
try {
tableservice.executeOperation(tableName, batch);
handleSuccess(null, batchOperationsCount);
} catch (StorageException e) {
LOGGER.error(i18nMessages.getMessage("error.ProcessBatch", actionData, e.getLocalizedMessage()));
handleReject(null, e, batchOperationsCount);
if (dieOnError) {
throw new ComponentException(e);
}
} catch (URISyntaxException | InvalidKeyException e) {
// connection problem so next operation will also fail, we stop the process
throw new ComponentException(e);
}
// reset operations, count and marker
batchOperations.clear();
batchRecords.clear();
batchOperationsCount = 0;
latestPartitionKey = "";
}
use of com.microsoft.azure.storage.table.TableBatchOperation in project timbuctoo by HuygensING.
the class AzureVreAuthorizationAccess method deleteVreAuthorizations.
@Override
public void deleteVreAuthorizations(String vreId) throws AuthorizationUnavailableException {
String condition = TableQuery.generateFilterCondition("PartitionKey", TableQuery.QueryComparisons.EQUAL, vreId);
TableBatchOperation deletes = new TableBatchOperation();
for (DynamicTableEntity entity : table.execute(TableQuery.from(DynamicTableEntity.class).where(condition))) {
deletes.delete(entity);
}
try {
table.execute(deletes);
} catch (StorageException e) {
LOG.error("deleteVreAuthorizations failed", e);
throw new AuthorizationUnavailableException("Could not delete authorizations");
}
}
use of com.microsoft.azure.storage.table.TableBatchOperation in project stdlib by petergeneric.
the class AzureLogStore method storeAsBatch.
@Retry
public void storeAsBatch(final List<LogLineTableEntity> lines) throws StorageException {
if (lines.isEmpty())
// nothing to do!
return;
TableBatchOperation operation = new TableBatchOperation();
for (LogLineTableEntity line : lines) {
if (log.isTraceEnabled())
log.trace("Storing entity with partition=" + line.getPartitionKey() + ", row=" + line.getRowKey());
operation.insertOrReplace(line);
}
logdata.execute(operation);
}
Aggregations