router

package
v0.5.4 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2019 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Broadcast

type Broadcast struct {
	core.SimpleRouter `gollumdoc:"embed_type"`
}

Broadcast router

This router implements the default behavior of routing all messages to all producers registered to the configured stream.

Examples

rateLimiter:
  Type: router.Broadcast
  Stream: errorlogs
  Filters:
    - filter.Rate:
      MessagesPerSec: 200

func (*Broadcast) Configure

func (router *Broadcast) Configure(conf core.PluginConfigReader)

Configure initializes this distributor with values from a plugin config.

func (*Broadcast) Enqueue

func (router *Broadcast) Enqueue(msg *core.Message) error

Enqueue enques a message to the router

func (*Broadcast) Start

func (router *Broadcast) Start() error

Start the router

type Distribute

type Distribute struct {
	Broadcast `gollumdoc:"embed_type"`
	// contains filtered or unexported fields
}

Distribute router plugin

The "Distribute" plugin provides 1:n stream remapping by duplicating messages.

During startup, it creates a set of streams with names listed in [TargetStreams]. During execution, it consumes messages from the stream [Stream] and enqueues copies of these messages onto each of the streams listed in [TargetStreams].

When routing to multiple routers, the incoming stream has to be listed explicitly to be used.

Parameters

- TargetStreams: List of streams to route the incoming messages to.

Examples

This example route incoming messages from `streamA` to `streamB` and `streamC` (duplication):

JunkRouterDist:
  Type: router.Distribute
  Stream: streamA
  TargetStreams:
    - streamB
    - streamC

func (*Distribute) Configure

func (router *Distribute) Configure(conf core.PluginConfigReader)

Configure initializes this distributor with values from a plugin config.

func (*Distribute) Enqueue

func (router *Distribute) Enqueue(msg *core.Message) error

Enqueue enques a message to the router

func (*Distribute) Start

func (router *Distribute) Start() error

Start the router

type Metadata

type Metadata struct {
	Broadcast `gollumdoc:"embed_type"`
	// contains filtered or unexported fields
}

Metadata router

This router routes the message to a stream given in a specified metadata field. If the field is not set, the message will be passed along.

Parameters

- Key: The metadata field to read from. By default this parameter is set to "Stream"

Examples

switchRoute:
  Type: router.Metadata
  Stream: errorlogs
  Key: key

func (*Metadata) Configure

func (router *Metadata) Configure(conf core.PluginConfigReader)

Configure initializes this distributor with values from a plugin config.

func (*Metadata) Enqueue

func (router *Metadata) Enqueue(msg *core.Message) error

Enqueue enques a message to the router

func (*Metadata) Start

func (router *Metadata) Start() error

Start the router

type Random

type Random struct {
	core.SimpleRouter `gollumdoc:"embed_type"`
}

Random router plugin

The "Random" router relays each message sent to the stream [Stream] to exactly one of the producers connected to [Stream]. The receiving producer is chosen randomly for each message.

Examples

This example will randomly send messages to one of the two console producers.

randomRouter:
  Type: router.Random
  Stream: randomStream

JunkPrinter00:
  Type: producer.Console
  Streams: randomStream
  Modulators:
    - format.Envelope:
        Prefix: "[junk_00] "

JunkPrinter01:
  Type: producer.Console
  Streams: randomStream
  Modulators:
    - format.Envelope:
        Prefix: "[junk_01] "

func (*Random) Configure

func (router *Random) Configure(conf core.PluginConfigReader)

Configure initializes this distributor with values from a plugin config.

func (*Random) Enqueue

func (router *Random) Enqueue(msg *core.Message) error

Enqueue enques a message to the router

func (*Random) Start

func (router *Random) Start() error

Start the router

type RoundRobin

type RoundRobin struct {
	core.SimpleRouter `gollumdoc:"embed_type"`
	// contains filtered or unexported fields
}

RoundRobin router

This router implements round robin routing. Messages are routed to exactly one of the producers registered to the given stream. The producer is switched in a round robin fashin after each message. This producer can be useful for load balancing, e.g. when the target service does not support sharding by itself.

Examples

This example will send message to the two console producers in an alternating fashin.

loadBalancer:
  Type: router.RoundRobin
  Stream: logs

JunkPrinter00:
  Type: producer.Console
  Streams: randomStream
  Modulators:
    - format.Envelope:
        Prefix: "[junk_00] "

JunkPrinter01:
  Type: producer.Console
  Streams: randomStream
  Modulators:
    - format.Envelope:
        Prefix: "[junk_01] "

func (*RoundRobin) Configure

func (router *RoundRobin) Configure(conf core.PluginConfigReader)

Configure initializes this distributor with values from a plugin config.

func (*RoundRobin) Enqueue

func (router *RoundRobin) Enqueue(msg *core.Message) error

Enqueue enques a message to the router

func (*RoundRobin) Start

func (router *RoundRobin) Start() error

Start the router

Jump to

Keyboard shortcuts

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