transport

package
v0.1.24 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2018 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func OptKafkaSendOnly

func OptKafkaSendOnly() func(k *Kafka) error

OptKafkaSendOnly creates producer only. Subscribe operation will panic

func OptRabbitMQExchangeName added in v0.1.18

func OptRabbitMQExchangeName(exchangeName string) func(mq *RabbitMQ) error

OptRabbitMQExchangeName sets the name of the RabbitMQ exchange used by the transport.

func OptRabbitMQSendOnly

func OptRabbitMQSendOnly() func(mq *RabbitMQ) error

OptRabbitMQSendOnly creates only sending connection. Subscribe operation will panic.

Types

type InMemory added in v0.1.20

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

InMemory provides event transport implemented completely in memory.

func NewInMemory added in v0.1.20

func NewInMemory() *InMemory

NewInMemory returns an initialized instance of InMemory event transport.

func (*InMemory) Close added in v0.1.20

func (m *InMemory) Close()

Close implements Transport interface close method.

func (*InMemory) Publish added in v0.1.20

func (m *InMemory) Publish(ctx context.Context, event *events.CloudEvent, topic string, organization string) error

Publish implements Transport interface publish method

func (*InMemory) Subscribe added in v0.1.20

func (m *InMemory) Subscribe(ctx context.Context, topic string, organization string, handler events.Handler) (events.Subscription, error)

Subscribe implements Transport interface subscribe method

type Kafka

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

Kafka Implements transport interface using Kafka broker.

func NewKafka

func NewKafka(brokerAddrs []string, options ...func(k *Kafka) error) (*Kafka, error)

NewKafka creates an instance of transport based on Kafka broker.

func (*Kafka) Close

func (k *Kafka) Close()

Close closes the transport

func (*Kafka) Publish

func (k *Kafka) Publish(ctx context.Context, event *events.CloudEvent, topic string, organization string) error

Publish publishes an event

func (*Kafka) Subscribe

func (k *Kafka) Subscribe(ctx context.Context, topic string, organization string, handler events.Handler) (events.Subscription, error)

Subscribe subscribes to an event

type Noop

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

Noop implements dummy transport which does nothing (optionally prints to the output specified)

func NewNoop

func NewNoop(out io.Writer) *Noop

NewNoop creates an instance of transport. out can be set to configure optional output.

func (*Noop) Close

func (t *Noop) Close()

Close closes transport.

func (*Noop) Publish

func (t *Noop) Publish(ctx context.Context, event *events.CloudEvent, topic string, organization string) error

Publish publishes event.

func (*Noop) Subscribe

func (t *Noop) Subscribe(ctx context.Context, topic string, organization string, handler events.Handler) (events.Subscription, error)

Subscribe subscribes to event.

type RabbitMQ

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

RabbitMQ implements transport over AMQP protocol and RabbitMQ messaging service

func NewRabbitMQ

func NewRabbitMQ(url string, options ...func(mq *RabbitMQ) error) (mq *RabbitMQ, err error)

NewRabbitMQ creates new instance of RabbitMQ MessageQueue driver. Accepts variadic list of function options.

func (*RabbitMQ) Close

func (mq *RabbitMQ) Close()

Close closes AMQP connections and stops all subscriptions

func (*RabbitMQ) Publish

func (mq *RabbitMQ) Publish(ctx context.Context, event *events.CloudEvent, topic string, organization string) error

Publish sends an event to RabbitMQ. Both topic and organization must be non-empty strings.

func (*RabbitMQ) Subscribe

func (mq *RabbitMQ) Subscribe(ctx context.Context, topic string, organization string, handler events.Handler) (events.Subscription, error)

Subscribe creates an active subscription on specified topic, and invokes handler function for every event received on given topic.

Jump to

Keyboard shortcuts

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