eventbus

package module
v0.0.0-...-fb40f1a Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2020 License: Apache-2.0 Imports: 0 Imported by: 0

README

Build Status Go Report Card Hex.pm

go-eventbus

Event bus for the GO programming language used to facilitate communication between clustered GO applications either in distributed or non-distributed systems. This tool is inspired by the Vert.X eventbus.

Features

The go-eventbus provides the following functionality:

  • Distributed caching
  • Point-to-point message sending via topic
  • Broadcasting messages via topic
  • Registering consumers to a topic
  • Message filtering by properties
  • Auto discovery of cluster nodes
  • Load balancing
  • Metrics
  • Logging
  • Timer tasks

Initial Tasks

  1. Determine a communication protocol used between nodes. Done, Websockets
  2. Get multiple nodes to talk to each other, no discovery
  3. Implement a heartbeat / remove bad nodes from cluster
  4. Add quorum to prevent split brain
  5. Add support for registering consumers of a topic
  6. Add support for sending messages to a topic (Publish and/or point-to-point)
  7. Add support for message delivery
  8. Add support for message reply to a temp topic

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EventBus

type EventBus interface {
	// CreateConsumer registers the provided lister with the specified topicId.
	// The listener will be invoked with messages received on the topicId
	CreateConsumer(topicID string, listener MessageListener) error

	// DeleteConsumer removes a registered consumer and its associated MessageHandler from the topic.
	DeleteConsumer(topicID string, messageListenerID string) error

	// PublishMessage publishes the message to all consumers registered to the topicId
	PublishMessage(message Message) error

	// SendMessage delivers the message to one matching consumer.
	SendMessage(message Message) error

	// GetCacheValue gets the value associated with the specified key
	GetCacheValue(key string) (interface{}, error)

	// SetCacheValue sets the value associated with the specified key
	SetCacheValue(key string, value interface{}) error
}

EventBus the interface which exposes functionality available via EventBus implementations

type Message

type Message struct {
	// MessageID the unique identifier for the message
	MessageID string

	// Topic the targeted topic for the message
	Topic string

	// Payload the payload of the message
	Payload string
}

Message a struct which contains the components needed to send a message via the EventBus

type MessageListener

type MessageListener struct {
	ID      string
	Handler func(message Message)
}

MessageListener an alias type for a function which accepts a string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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