2018-04-13 21:26:56 +00:00
|
|
|
package interfaces
|
2018-04-11 03:50:18 +00:00
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"time"
|
|
|
|
|
|
|
|
|
|
ks "github.com/aws/aws-sdk-go/service/kinesis"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
const (
|
2018-04-17 16:25:41 +00:00
|
|
|
/**
|
|
|
|
|
* Indicates that the entire application is being shutdown, and if desired the record processor will be given a
|
|
|
|
|
* final chance to checkpoint. This state will not trigger a direct call to
|
|
|
|
|
* {@link com.amazonaws.services.kinesis.clientlibrary.interfaces.v2.IRecordProcessor#shutdown(ShutdownInput)}, but
|
|
|
|
|
* instead depend on a different interface for backward compatibility.
|
|
|
|
|
*/
|
|
|
|
|
REQUESTED ShutdownReason = iota + 1
|
|
|
|
|
/**
|
|
|
|
|
* Terminate processing for this RecordProcessor (resharding use case).
|
|
|
|
|
* Indicates that the shard is closed and all records from the shard have been delivered to the application.
|
|
|
|
|
* Applications SHOULD checkpoint their progress to indicate that they have successfully processed all records
|
|
|
|
|
* from this shard and processing of child shards can be started.
|
|
|
|
|
*/
|
|
|
|
|
TERMINATE
|
|
|
|
|
/**
|
|
|
|
|
* Processing will be moved to a different record processor (fail over, load balancing use cases).
|
|
|
|
|
* Applications SHOULD NOT checkpoint their progress (as another record processor may have already started
|
|
|
|
|
* processing data).
|
|
|
|
|
*/
|
|
|
|
|
ZOMBIE
|
2018-04-11 03:50:18 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
// Containers for the parameters to the IRecordProcessor
|
|
|
|
|
type (
|
2018-04-17 16:25:41 +00:00
|
|
|
/**
|
|
|
|
|
* Reason the RecordProcessor is being shutdown.
|
|
|
|
|
* Used to distinguish between a fail-over vs. a termination (shard is closed and all records have been delivered).
|
|
|
|
|
* In case of a fail over, applications should NOT checkpoint as part of shutdown,
|
|
|
|
|
* since another record processor may have already started processing records for that shard.
|
|
|
|
|
* In case of termination (resharding use case), applications SHOULD checkpoint their progress to indicate
|
|
|
|
|
* that they have successfully processed all the records (processing of child shards can then begin).
|
|
|
|
|
*/
|
2018-04-11 03:50:18 +00:00
|
|
|
ShutdownReason int
|
|
|
|
|
|
|
|
|
|
InitializationInput struct {
|
2018-04-17 16:25:41 +00:00
|
|
|
ShardId string
|
|
|
|
|
ExtendedSequenceNumber *ExtendedSequenceNumber
|
|
|
|
|
PendingCheckpointSequenceNumber *ExtendedSequenceNumber
|
2018-04-11 03:50:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ProcessRecordsInput struct {
|
2018-04-17 16:25:41 +00:00
|
|
|
CacheEntryTime *time.Time
|
|
|
|
|
CacheExitTime *time.Time
|
|
|
|
|
Records []*ks.Record
|
|
|
|
|
Checkpointer IRecordProcessorCheckpointer
|
|
|
|
|
MillisBehindLatest int64
|
2018-04-11 03:50:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ShutdownInput struct {
|
2018-04-17 16:25:41 +00:00
|
|
|
ShutdownReason ShutdownReason
|
|
|
|
|
Checkpointer IRecordProcessorCheckpointer
|
2018-04-11 03:50:18 +00:00
|
|
|
}
|
|
|
|
|
)
|