simplemq

package module
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Message

type Message struct {
	ExternalID string    `json:"external_id"`
	Received   time.Time `json:"Received"`
	Payload    string    `json:"payload"`
}

type SimpleMQ

type SimpleMQ struct {
	Addr  string
	Path  string
	Queue []Message
	Srv   *http.Server

	sync.Mutex
	// contains filtered or unexported fields
}

SimpleMQ is a very simple queue.

func New

func New(addr, path string) *SimpleMQ

New creates a new simple queue service that will listen to the given address.

func (*SimpleMQ) Dequeue

func (s *SimpleMQ) Dequeue() Message

Dequeue dequeue an element from the given queue.

func (*SimpleMQ) Enqueue

func (s *SimpleMQ) Enqueue(m Message)

Enqueue enqueue a message to a queue.

func (*SimpleMQ) ListenAndServe

func (s *SimpleMQ) ListenAndServe() error

ListenAndServe starts de queue, it blocks the calling goroutine.

func (*SimpleMQ) Stop

func (s *SimpleMQ) Stop() error

Stop stops the underlaying http server.

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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