Skip to content

things-kit/things-kit-messaging

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Things-Kit Messaging

Messaging Interface Abstraction for Things-Kit

This module defines the messaging abstraction for Things-Kit applications. It contains only interfaces, no implementation.

Installation

go get github.com/things-kit/things-kit-messaging

Purpose

The things-kit-messaging package defines the contracts for message handling in distributed systems. This allows applications to program against stable interfaces while being free to choose any messaging backend (Kafka, RabbitMQ, NATS, SQS, etc.).

Interfaces

Message

type Message interface {
    Topic() string
    Key() []byte
    Value() []byte
    Headers() map[string]string
    Timestamp() time.Time
}

Handler

type Handler interface {
    Handle(ctx context.Context, msg Message) error
    Topic() string
}

Consumer

type Consumer interface {
    RegisterHandler(handler Handler)
    Start(ctx context.Context) error
    Stop(ctx context.Context) error
}

Producer

type Producer interface {
    Produce(ctx context.Context, msg Message) error
    Close() error
}

Available Implementations

things-kit-kafka

The things-kit-kafka module provides a Kafka-based implementation.

License

MIT License - see LICENSE file for details

About

Things-Kit Messaging Interface - Messaging abstraction for message queues and event-driven architectures

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages