example

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Example (Plugin)
package main

import (
	"context"

	plugin "github.com/LeKovr/mqbridge/plugins/example"
	"github.com/LeKovr/mqbridge/types"
)

func main() {
	ctx, cancel := context.WithCancel(context.Background())
	epa := types.NewBlankEndPointAttr(ctx)
	plug, _ := plugin.New(epa, "test")
	pipe := make(chan string)
	plug.Listen(0, "1:100", pipe)
	plug.Notify(0, "", pipe)
	<-epa.Abort
	cancel()
	epa.WG.Wait()
}
Output:

sample 0

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(epa types.EndPointAttr, dsn string) (types.EndPoint, error)

New creates endpoint

Types

type EndPoint

type EndPoint struct {
	types.EndPointAttr
}

EndPoint holds endpoint

func (EndPoint) Listen

func (ep EndPoint) Listen(id int, channel string, pipe chan string) error

Listen starts all listening goroutines

func (EndPoint) Notify

func (ep EndPoint) Notify(id int, channel string, pipe chan string) error

Notify starts all notify goroutines

Jump to

Keyboard shortcuts

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