com.amazonaws.services.kinesis.clientlibrary.interfaces.v2.IRecordProcessor Java Examples

The following examples show how to use com.amazonaws.services.kinesis.clientlibrary.interfaces.v2.IRecordProcessor. 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: StreamsRecordProcessorFactory.java    From dynamo-cassandra-proxy with Apache License 2.0 4 votes vote down vote up
@Override
public IRecordProcessor createProcessor() {
    return new StreamsRecordProcessor(dynamoDBClient, tableName);
}
 
Example #2
Source File: DynamoDBTableReplicator.java    From podyn with Apache License 2.0 4 votes vote down vote up
@Override
public IRecordProcessor createProcessor() {
	return createStreamProcessor();
}
 
Example #3
Source File: DynamoDBTableReplicator.java    From podyn with Apache License 2.0 4 votes vote down vote up
protected IRecordProcessor createStreamProcessor() {
	return new IRecordProcessor() {

		@Override
		public void initialize(InitializationInput initializationInput) {
		}

		public List<Record> extractDynamoStreamRecords(List<com.amazonaws.services.kinesis.model.Record> kinesisRecords) {
			List<Record> dynamoRecords = new ArrayList<>(kinesisRecords.size());

			for(com.amazonaws.services.kinesis.model.Record kinesisRecord : kinesisRecords) {
				if (kinesisRecord instanceof RecordAdapter) {
					Record dynamoRecord = ((RecordAdapter) kinesisRecord).getInternalObject();
					dynamoRecords.add(dynamoRecord);
				}
			}

			return dynamoRecords;
		}

		@Override
		public void processRecords(ProcessRecordsInput processRecordsInput) {
			List<Record> records = extractDynamoStreamRecords(processRecordsInput.getRecords());

			DynamoDBTableReplicator.this.processRecords(records);

			checkpoint(processRecordsInput.getCheckpointer());
		}

		@Override
		public void shutdown(ShutdownInput shutdownInput) {
			if (shutdownInput.getShutdownReason() == ShutdownReason.TERMINATE) {
				checkpoint(shutdownInput.getCheckpointer());
			}
		}

		void checkpoint(IRecordProcessorCheckpointer checkpointer) {
			try {
				checkpointer.checkpoint();
			} catch (KinesisClientLibDependencyException|InvalidStateException|ThrottlingException|ShutdownException e) {
				LOG.warn(e);
			}
		}
	};
}
 
Example #4
Source File: KinesisCollector.java    From zipkin-aws with Apache License 2.0 4 votes vote down vote up
@Override
public IRecordProcessor createProcessor() {
  return new KinesisSpanProcessor(collector, metrics);
}
 
Example #5
Source File: StreamsRecordProcessorFactory.java    From aws-doc-sdk-examples with Apache License 2.0 4 votes vote down vote up
@Override
public IRecordProcessor createProcessor() {
    return new StreamsRecordProcessor(dynamoDBClient, tableName);
}
 
Example #6
Source File: StreamsRecordProcessorFactory.java    From pulsar with Apache License 2.0 4 votes vote down vote up
@Override
public IRecordProcessor createProcessor() {
    return new StreamsRecordProcessor(queue, config);
}
 
Example #7
Source File: StreamSetsRecordProcessorFactory.java    From datacollector with Apache License 2.0 4 votes vote down vote up
@Override
public IRecordProcessor createProcessor() {
  return new StreamSetsRecordProcessor(context, parserFactory, maxBatchSize, error, throttleWaitTime, throttleMaxRetries);
}