 Documentation
      ¶
      Documentation
      ¶
    
    
  
    
  
    Index ¶
- func Concurrent[T any](concurrency uint, handler func(context.Context, T)) (func(context.Context, T), func())
- func MessageExpiryTimeout(ctx context.Context, expiry uint32, s string) (context.Context, context.CancelFunc)
- func MetadataToProp(data map[string]string) (map[string]string, error)
- func PropToMetadata(prop map[string]string) map[string]string
- func ValidTopic(topic string) bool
- func ValidateShareName(shareName string) error
- type Timeout
- type TopicPattern
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Concurrent ¶
func Concurrent[T any]( concurrency uint, handler func(context.Context, T), ) (func(context.Context, T), func())
Manages sending values to handlers with a configured maximum currency (where 0 indicates unlimited concurrency). Returns a function to send a value to the handlers and a cleanup function.
func MessageExpiryTimeout ¶
func MessageExpiryTimeout( ctx context.Context, expiry uint32, s string, ) (context.Context, context.CancelFunc)
Translate an MQTT message expiry into a timeout. Use for WithMessageExpiry.
func ValidTopic ¶
Return whether the provided string is a fully-resolved topic.
func ValidateShareName ¶
Return whether the provided string is a valid share name.
Types ¶
type TopicPattern ¶
Structure to apply tokens to a named topic pattern.
func NewTopicPattern ¶
func NewTopicPattern( name, pattern string, tokens map[string]string, namespace string, ) (TopicPattern, error)
Create a new topic pattern and perform initial validations.
func (TopicPattern) Apply ¶
func (tp TopicPattern) Apply(tokens map[string]string) TopicPattern
Apply the given token values to the MQTT topic and return the result (which may still have remaining unresolved tokens).
func (TopicPattern) Filter ¶
func (tp TopicPattern) Filter() (string, error)
Generate a regexp for subscribing. Unresolved tokens are treated as "+" wildcards for this purpose.