Documentation ¶
Overview ¶
Package worker
Package worker ¶
Package worker The implementation is derived from https://github.com/patrobinson/gokini
Copyright 2018 Patrick robinson.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Package worker ¶
Package worker ¶
Package worker The implementation is derived from https://github.com/patrobinson/gokini
Copyright 2018 Patrick robinson.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Index ¶
Constants ¶
const ( MaxBytes = 10000000 MaxBytesPerSecond = 2000000 BytesToMbConversion = 1000000 )
Variables ¶
This section is empty.
Functions ¶
func NewRecordProcessorCheckpoint ¶
func NewRecordProcessorCheckpoint(shard *par.ShardStatus, checkpoint chk.Checkpointer) kcl.IRecordProcessorCheckpointer
Types ¶
type FanOutShardConsumer ¶
type FanOutShardConsumer struct {
// contains filtered or unexported fields
}
FanOutShardConsumer is responsible for consuming data records of a (specified) shard. Note: FanOutShardConsumer only deal with one shard. For more info see: https://docs.aws.amazon.com/streams/latest/dev/enhanced-consumers.html
type KinesisSubscriberGetter ¶ added in v0.0.5
type KinesisSubscriberGetter interface { SubscribeToShard(ctx context.Context, params *kinesis.SubscribeToShardInput, optFns ...func(*kinesis.Options)) (*kinesis.SubscribeToShardOutput, error) GetShardIterator(ctx context.Context, params *kinesis.GetShardIteratorInput, optFns ...func(*kinesis.Options)) (*kinesis.GetShardIteratorOutput, error) GetRecords(ctx context.Context, params *kinesis.GetRecordsInput, optFns ...func(*kinesis.Options)) (*kinesis.GetRecordsOutput, error) }
type PollingShardConsumer ¶
type PollingShardConsumer struct {
// contains filtered or unexported fields
}
PollingShardConsumer is responsible for polling data records from a (specified) shard. Note: PollingShardConsumer only deal with one shard.
type PreparedCheckpointer ¶
type PreparedCheckpointer struct {
// contains filtered or unexported fields
}
PreparedCheckpointer
- Objects of this class are prepared to checkpoint at a specific sequence number. They use an
- IRecordProcessorCheckpointer to do the actual checkpointing, so their checkpoint is subject to the same 'didn't go
- backwards' validation as a normal checkpoint.
func (*PreparedCheckpointer) Checkpoint ¶
func (pc *PreparedCheckpointer) Checkpoint() error
func (*PreparedCheckpointer) GetPendingCheckpoint ¶
func (pc *PreparedCheckpointer) GetPendingCheckpoint() *kcl.ExtendedSequenceNumber
type RecordProcessorCheckpointer ¶
type RecordProcessorCheckpointer struct {
// contains filtered or unexported fields
}
RecordProcessorCheckpointer
- This class is used to enable RecordProcessors to checkpoint their progress.
- The Amazon Kinesis Client Library will instantiate an object and provide a reference to the application
- RecordProcessor instance. Amazon Kinesis Client Library will create one instance per shard assignment.
func (*RecordProcessorCheckpointer) Checkpoint ¶
func (rc *RecordProcessorCheckpointer) Checkpoint(sequenceNumber *string) error
func (*RecordProcessorCheckpointer) PrepareCheckpoint ¶
func (rc *RecordProcessorCheckpointer) PrepareCheckpoint(_ *string) (kcl.IPreparedCheckpointer, error)
type Worker ¶
type Worker struct {
// contains filtered or unexported fields
}
Worker is the high level class that Kinesis applications use to start processing data. It initializes and oversees different components (e.g. syncing shard and lease information, tracking shard assignments, and processing data from the shards).
func NewWorker ¶
func NewWorker(factory kcl.IRecordProcessorFactory, kclConfig *config.KinesisClientLibConfiguration) *Worker
NewWorker constructs a Worker instance for processing Kinesis stream data.
func (*Worker) Shutdown ¶
func (w *Worker) Shutdown()
Shutdown signals worker to shut down. Worker will try initiating shutdown of all record processors.
func (*Worker) Start ¶
Start Run starts consuming data from the stream, and pass it to the application record processors.
func (*Worker) WithCheckpointer ¶
func (w *Worker) WithCheckpointer(checker chk.Checkpointer) *Worker
WithCheckpointer is used to provide a custom checkpointer service for non-dynamodb implementation or unit testing.