worker

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 15, 2019 License: MIT Imports: 13 Imported by: 8

Documentation

Overview

  • Copyright (c) 2018 VMware, Inc. *

  • 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.

  • Copyright (c) 2018 VMware, Inc. *

  • 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.

The implementation is derived from https://github.com/patrobinson/gokini

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.

  • Copyright (c) 2018 VMware, Inc. *
  • 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.

The implementation is derived from https://github.com/patrobinson/gokini

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

This section is empty.

Variables

This section is empty.

Functions

func NewRecordProcessorCheckpoint

func NewRecordProcessorCheckpoint(shard *par.ShardStatus, checkpoint chk.Checkpointer) kcl.IRecordProcessorCheckpointer

Types

type PreparedCheckpointer

type PreparedCheckpointer struct {
	// contains filtered or unexported fields
}
 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
}

*

  • 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(sequenceNumber *string) (kcl.IPreparedCheckpointer, error)

type ShardConsumer

type ShardConsumer struct {
	// contains filtered or unexported fields
}

ShardConsumer is responsible for consuming data records of a (specified) shard. Note: ShardConsumer only deal with one shard.

type ShardConsumerState

type ShardConsumerState int
const (
	// This is the initial state of a shard consumer. This causes the consumer to remain blocked until the all
	// parent shards have been completed.
	WAITING_ON_PARENT_SHARDS ShardConsumerState = iota + 1

	// This state is responsible for initializing the record processor with the shard information.
	INITIALIZING

	//
	PROCESSING

	SHUTDOWN_REQUESTED

	SHUTTING_DOWN

	SHUTDOWN_COMPLETE

	// ErrCodeKMSThrottlingException is defined in the API Reference https://docs.aws.amazon.com/sdk-for-go/api/service/kinesis/#Kinesis.GetRecords
	// But it's not a constant?
	ErrCodeKMSThrottlingException = "KMSThrottlingException"
)

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

NewWorker constructs a Worker instance for processing Kinesis stream data.

func (*Worker) Publish

func (w *Worker) Publish(streamName, partitionKey string, data []byte) error

Publish to write some data into stream. This function is mainly used for testing purpose.

func (*Worker) Shutdown

func (w *Worker) Shutdown()

Shutdown signals worker to shutdown. Worker will try initiating shutdown of all record processors.

func (*Worker) Start

func (w *Worker) Start() error

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.

func (*Worker) WithKinesis

func (w *Worker) WithKinesis(svc kinesisiface.KinesisAPI) *Worker

WithKinesis is used to provide Kinesis service for either custom implementation or unit testing.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL