bus

package
v0.0.0-...-7077701 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2020 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Licensed under the Apache License, Version 2.0 (the "License"); you may not use p file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddCtxHandler

func AddCtxHandler(implName string, handler HandlerFunc)

Package level functions

func AddEventListener

func AddEventListener(handler HandlerFunc)

Package level functions

func AddHandler

func AddHandler(implName string, handler HandlerFunc)

Package level functions

func AddWildcardListener

func AddWildcardListener(handler HandlerFunc)

func ClearBusHandlers

func ClearBusHandlers()

func Dispatch

func Dispatch(msg Msg) error

func DispatchCtx

func DispatchCtx(ctx context.Context, msg Msg) error

func Publish

func Publish(msg Msg) error

Types

type Bus

type Bus interface {
	Dispatch(msg Msg) error
	DispatchCtx(ctx context.Context, msg Msg) error
	Publish(msg Msg) error

	AddHandler(handler HandlerFunc)
	AddCtxHandler(handler HandlerFunc)
	AddEventListener(handler HandlerFunc)
	AddWildcardListener(handler HandlerFunc)
}

func New

func New() Bus

type CtxHandlerFunc

type CtxHandlerFunc func()

type HandlerFunc

type HandlerFunc interface{}

type InProcBus

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

func (*InProcBus) AddCtxHandler

func (b *InProcBus) AddCtxHandler(handler HandlerFunc)

func (*InProcBus) AddEventListener

func (b *InProcBus) AddEventListener(handler HandlerFunc)

func (*InProcBus) AddHandler

func (b *InProcBus) AddHandler(handler HandlerFunc)

func (*InProcBus) AddWildcardListener

func (b *InProcBus) AddWildcardListener(handler HandlerFunc)

func (*InProcBus) Dispatch

func (b *InProcBus) Dispatch(msg Msg) error

func (*InProcBus) DispatchCtx

func (b *InProcBus) DispatchCtx(ctx context.Context, msg Msg) error

func (*InProcBus) Publish

func (b *InProcBus) Publish(msg Msg) error

type Msg

type Msg interface{}

Jump to

Keyboard shortcuts

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