Documentation
¶
Index ¶
- Constants
- func MustNewSubscriberPipeline(params SubscriberPipelineParams) subscriberPipeline
- func NewSubscriberPipeline(params SubscriberPipelineParams) (subscriberPipeline, error)
- type Doer
- type Getter
- type PubSubClient
- type PublishInput
- type Publisher
- type SubscriberPipeline
- type SubscriberPipelineParams
- type ToByteser
- type TopicWrapper
Constants ¶
const TraceIDContextKey string = "trace_id"
TraceIDContextKey defines the trace id key in a context.
Variables ¶
This section is empty.
Functions ¶
func MustNewSubscriberPipeline ¶ added in v1.1.0
func MustNewSubscriberPipeline(params SubscriberPipelineParams) subscriberPipeline
MustNewSubscriberPipeline initializes subscriberPipeline by calling NewSubscriberPipeline It panics if any error is found.
func NewSubscriberPipeline ¶ added in v1.1.0
func NewSubscriberPipeline(params SubscriberPipelineParams) (subscriberPipeline, error)
NewSubscriberPipeline creates a new instance of subscriberPipeline. The pipeline initiates with only one step: subscriberReceiver (which receives raw messages from Pubsub).
Types ¶
type Doer ¶ added in v1.1.0
type Doer interface { // Do executes a pipe entry. Do(context.Context, chan any, chan error) chan any }
Doer indicates how pipeline steps should execute each interaction with the pipe.
type PubSubClient ¶
type PubSubClient[T ToByteser] struct { // contains filtered or unexported fields }
PubSubClient is responsible for managing a pubsub topic.
func MustNewPubSubClient ¶
func MustNewPubSubClient[T ToByteser](topic Publisher) PubSubClient[T]
MustNewPubSubClient initializes Publisher by calling NewPubSubClient It panics if any error is found.
func NewPubSubClient ¶
func NewPubSubClient[T ToByteser](topic Publisher) (PubSubClient[T], error)
NewPubSubClient returns a new instance of PubSubClient.
func (PubSubClient[T]) Publish ¶
func (c PubSubClient[T]) Publish(ctx context.Context, in ...PublishInput[T]) []error
Publish publishes messages in a pubsub topic.
type PublishInput ¶
PublishInput is the input for publishing data in a topic.
type SubscriberPipeline ¶ added in v1.1.0
type SubscriberPipeline interface { // Run executes the pipeline, connecting each registered step in a ordered way. Run(ctx context.Context) chan any // Map registers a new Mapper step into pipeline, which is modifies the data that passes // through the pipeline. It panics if any required dependency is not properly given. Map(mapFn func(any) (any, error)) SubscriberPipeline // Reduce registers a new Reducer step into pipeline. // It panics if any required dependency is not properly given. Reduce(reduceFn func(state interface{}, item interface{}, idx int) (newState interface{}, err error), initialState func() interface{}) SubscriberPipeline // Batch registers a new Batcher step into pipeline. // It panics if any required dependency is not properly given. Batch(itemType reflect.Type, batchSize int, timeout time.Duration) SubscriberPipeline // Errors exposes all errors that happens during pipeline processing. Errors() chan error }
SubscriberPipeline is a structure that defines a pubsub pipeline data handler.
type SubscriberPipelineParams ¶ added in v1.1.0
type SubscriberPipelineParams struct { PubsubSubscription steps.Receiver // contains filtered or unexported fields }
SubscriberPipelineParams encapsulates dependencies for a SubscriberPipelineParams instance.
type TopicWrapper ¶
type TopicWrapper struct {
// contains filtered or unexported fields
}
TopicWrapper envelopes a pubsub topic type.
func NewTopicWrapper ¶
func NewTopicWrapper(topic *pubsub.Topic) TopicWrapper
NewTopicWrapper returns a new instance of TopicWrapper.
Directories
¶
Path | Synopsis |
---|---|
Package mocks is a generated GoMock package.
|
Package mocks is a generated GoMock package. |