Java Code Examples for com.amazonaws.services.kinesis.producer.UserRecordResult#isSuccessful()

The following examples show how to use com.amazonaws.services.kinesis.producer.UserRecordResult#isSuccessful() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: KinesisTarget.java    From datacollector with Apache License 2.0 6 votes vote down vote up
private void getAndCheck(Future<UserRecordResult> future) throws StageException {
  try {
    UserRecordResult result = future.get();
    if (!result.isSuccessful()) {
      for (Attempt attempt : result.getAttempts()) {
        LOG.error("Failed to put record: {}", attempt.getErrorMessage());
      }
      throw new StageException(Errors.KINESIS_00, result.getAttempts().get(0).getErrorMessage());
    }

    if (responseConf.sendResponseToOrigin &&
        this.responseConf.responseType.equals(ResponseType.DESTINATION_RESPONSE)) {
      getContext().toSourceResponse(generateDestResponseRecord(result));
    }

  } catch (InterruptedException | ExecutionException e) {
    LOG.error("Pipeline is shutting down.", e);
    // We should flush if we encounter an error.
    kinesisProducer.flushSync();
  }
}
 
Example 2
Source File: Stream.java    From amazon-neptune-tools with Apache License 2.0 4 votes vote down vote up
@Override
public void onSuccess(UserRecordResult userRecordResult) {
    if (!userRecordResult.isSuccessful()) {
        logger.error("Unsuccessful attempt to write to stream: " + formatAttempts(userRecordResult.getAttempts()));
    }
}