...

Source file src/edge-infra.dev/pkg/lib/mqtt/client.go

Documentation: edge-infra.dev/pkg/lib/mqtt

     1  package mqtt
     2  
     3  import (
     4  	"context"
     5  )
     6  
     7  // based off of paho.mqtt.golang: https://github.com/eclipse/paho.mqtt.golang
     8  // in the future can implment methods for Connect, Disconnect, Subscribe etc.
     9  type Client interface {
    10  	Publish(context.Context, Payload) error
    11  }
    12  
    13  type Payload interface {
    14  	Data() []byte
    15  	Attributes() map[string]string
    16  }
    17  
    18  // NopPublisher does nothing when you call Publish. This is for stubbing purposes.
    19  type NopPublisher struct{}
    20  
    21  // Publish does nothing
    22  func (n NopPublisher) Publish(_ context.Context, _ Payload) error {
    23  	return nil
    24  }
    25  

View as plain text