topicmapper

package
v2.7.3 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package topicmapper maps MQTT topic to Kafka topics and key-value headers

Index

Constants

View Source
const (
	// Kind is the kind of TopicMapper
	Kind = "TopicMapper"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Policy

type Policy struct {
	Name       string         `json:"name" jsonschema:"required"`
	TopicIndex int            `json:"topicIndex" jsonschema:"required"`
	Route      []TopicRe      `json:"route" jsonschema:"required"`
	Headers    map[int]string `json:"headers" jsonschema:"required"`
}

Policy describes topic map between MQTT topic and Backend MQ topic

type PolicyRe

type PolicyRe struct {
	Name      string `json:"name" jsonschema:"required"`
	MatchExpr string `json:"matchExpr" jsonschema:"required"`
}

PolicyRe to match right policy to do topic map

type SetKV

type SetKV struct {
	Topic   string `json:"topic" jsonschema:"topic"`
	Headers string `json:"headers" jsonschema:"headers"`
}

SetKV set topic mapper result to MQTT context kv map

type Spec

type Spec struct {
	filters.BaseSpec `json:",inline"`

	MatchIndex int         `json:"matchIndex" jsonschema:"required"`
	Route      []*PolicyRe `json:"route" jsonschema:"required"`
	Policies   []*Policy   `json:"policies" jsonschema:"required"`
	SetKV      *SetKV      `json:"setKV" jsonschema:"required"`
}

Spec is spec of Kafka

type TopicMapper

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

TopicMapper map MQTT multi-level topic into topic and key-value headers

func (*TopicMapper) Close

func (k *TopicMapper) Close()

Close close TopicMapper

func (*TopicMapper) Handle

func (k *TopicMapper) Handle(ctx *context.Context) string

Handle handle context

func (*TopicMapper) Inherit

func (k *TopicMapper) Inherit(previousGeneration filters.Filter)

Inherit init TopicMapper based on previous generation

func (*TopicMapper) Init

func (k *TopicMapper) Init()

Init init TopicMapper

func (*TopicMapper) Kind

func (k *TopicMapper) Kind() *filters.Kind

Kind return kind of TopicMapper

func (*TopicMapper) Name

func (k *TopicMapper) Name() string

Name returns the name of the TopicMapper filter instance.

func (*TopicMapper) Spec

func (k *TopicMapper) Spec() filters.Spec

Spec returns the spec used by the TopicMapper

func (*TopicMapper) Status

func (k *TopicMapper) Status() interface{}

Status return status of TopicMapper

type TopicRe

type TopicRe struct {
	Topic string   `json:"topic" jsonschema:"required"`
	Exprs []string `json:"exprs" jsonschema:"required"`
}

TopicRe to match right topic in given policy

Jump to

Keyboard shortcuts

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