@Override public boolean start() throws IOException { try { if (peek) { messages = queueService.peekMessages(queueName, nbMsg).iterator(); } else { messages = queueService.retrieveMessages(queueName, nbMsg, visibilityTimeout).iterator(); } startable = messages.hasNext(); if (startable) { dataCount++; current = messages.next(); if (delete) { try { queueService.deleteMessage(queueName, current); } catch (StorageException e) { LOGGER.error(i18nMessages.getMessage("error.Cannotdelete", current.getId(), e.getLocalizedMessage())); } } } } catch (InvalidKeyException | URISyntaxException | StorageException e) { LOGGER.error(e.getLocalizedMessage()); if (dieOnError) throw new ComponentException(e); } return startable; }
@Override public boolean start() throws IOException { try { if (peek) { messages = queueService.peekMessages(queueName, nbMsg).iterator(); } else { messages = queueService.retrieveMessages(queueName, nbMsg, visibilityTimeout).iterator(); } startable = messages.hasNext(); if (startable) { dataCount++; current = messages.next(); if (delete) { try { queueService.deleteMessage(queueName, current); } catch (StorageException e) { LOGGER.error(i18nMessages.getMessage("error.Cannotdelete", current.getId(), e.getLocalizedMessage())); } } } } catch (InvalidKeyException | URISyntaxException | StorageException e) { LOGGER.error(e.getLocalizedMessage()); if (dieOnError) throw new ComponentException(e); } return startable; }
@Override public void accept(IndexedRecord record) { try { DynamicTableEntity entity = createDynamicEntityFromInputRecord(record, writeSchema); tableservice.executeOperation(tableName, getTableOperation(entity)); handleSuccess(record, 1); } catch (StorageException e) { LOGGER.error(i18nMessages.getMessage("error.ProcessSingleOperation", actionData, e.getLocalizedMessage()), e); if (dieOnError) { throw new ComponentException(e); } handleReject(record, e, 1); } catch (URISyntaxException | InvalidKeyException e) { throw new ComponentException(e); // connection problem so next operation will also fail, we stop the process } } });
@Override public void accept(IndexedRecord record) { try { DynamicTableEntity entity = createDynamicEntityFromInputRecord(record, writeSchema); tableservice.executeOperation(tableName, getTableOperation(entity)); handleSuccess(record, 1); } catch (StorageException e) { LOGGER.error(i18nMessages.getMessage("error.ProcessSingleOperation", actionData, e.getLocalizedMessage()), e); if (dieOnError) { throw new ComponentException(e); } handleReject(record, e, 1); } catch (URISyntaxException | InvalidKeyException e) { throw new ComponentException(e); // connection problem so next operation will also fail, we stop the process } } });
@Override public void accept(QueueMessage queueMessage) { try { queue.addMessage(queueMessage.getMsg(), queueMessage.getTimeToLiveInSeconds(), queueMessage.getInitialVisibilityDelayInSeconds(), null, null); synchronized (this) { result.successCount++; IndexedRecord record = new Record(writeSchema); record.put(0, queueMessage.getMsg().getMessageContentAsString()); successfulWrites.add(record); } } catch (StorageException e) { result.rejectCount++; LOGGER.error(e.getLocalizedMessage()); } } });
@Override public void accept(QueueMessage queueMessage) { try { queue.addMessage(queueMessage.getMsg(), queueMessage.getTimeToLiveInSeconds(), queueMessage.getInitialVisibilityDelayInSeconds(), null, null); synchronized (this) { result.successCount++; IndexedRecord record = new Record(writeSchema); record.put(0, queueMessage.getMsg().getMessageContentAsString()); successfulWrites.add(record); } } catch (StorageException e) { result.rejectCount++; LOGGER.error(e.getLocalizedMessage()); } } });
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) { throw new ComponentException(e); // connection problem so next operation will also fail, we stop the process } // reset operations, count and marker batchOperations.clear(); batchRecords.clear(); batchOperationsCount = 0; latestPartitionKey = ""; }
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) { throw new ComponentException(e); // connection problem so next operation will also fail, we stop the process } // reset operations, count and marker batchOperations.clear(); batchRecords.clear(); batchOperationsCount = 0; latestPartitionKey = ""; }
IndexedRecord reject = new GenericData.Record(rejectSchema); reject.put(rejectSchema.getField("errorCode").pos(), e.getErrorCode()); reject.put(rejectSchema.getField("errorMessage").pos(), e.getLocalizedMessage()); for (Schema.Field outField : reject.getSchema().getFields()) { Object outValue; IndexedRecord reject = new GenericData.Record(rejectSchema); reject.put(rejectSchema.getField("errorCode").pos(), e.getErrorCode()); reject.put(rejectSchema.getField("errorMessage").pos(), e.getLocalizedMessage()); for (Schema.Field outField : reject.getSchema().getFields()) { Object outValue;
IndexedRecord reject = new GenericData.Record(rejectSchema); reject.put(rejectSchema.getField("errorCode").pos(), e.getErrorCode()); reject.put(rejectSchema.getField("errorMessage").pos(), e.getLocalizedMessage()); for (Schema.Field outField : reject.getSchema().getFields()) { Object outValue; IndexedRecord reject = new GenericData.Record(rejectSchema); reject.put(rejectSchema.getField("errorCode").pos(), e.getErrorCode()); reject.put(rejectSchema.getField("errorMessage").pos(), e.getLocalizedMessage()); for (Schema.Field outField : reject.getSchema().getFields()) { Object outValue;
LOGGER.error(e.getLocalizedMessage()); if (dieOnError) throw new ComponentException(e);
LOGGER.error(e.getLocalizedMessage()); if (dieOnError) throw new ComponentException(e);