go-mms

module
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2024 License: Apache-2.0

README

go-mms

Go codecov

Go client for MET Messaging system (MMS)

How to use

Building

To be able to use the statik binary, you need to have go's bin directory in the path, most probably ~/go/bin or ~/.local/go/bin. We found this to be solved by using these paths:

export GOPATH=$HOME/go
export PATH=$GOPATH/bin:$PATH
export PATH=$PATH:/usr/local/go/bin
  • cd go-mms
  • make edeps
  • make statik
  • make deps
  • make

Use

See mms and mmsd

The first step is only relevant for a system where MMS has been installed as a module.

Core NATS

To run the nats server configured in core NATS

./mmsd 

To post an event to a queue

./mms post --api-key key --production-hub url  --queue-name queueName

key is generated by running

./mmsd keys --gen

To subscribe to a queue

./mms s --production-hub nats://localhost:4222 --queue-name queueName

NATS Jetstream

To run the nats server configured to enable Nats Jetstream

./mmsd --nats-local=false --nats-url=url --cred-file=/path/to/cred-file.cred --nats-cred-path=/path/to/cred-file/directory

nats-local is true by default and is meant for `Core NATS``

To post an event to a queue

./mms post --api-key key --production-hub url  --queue-name queueName   

key is key from the cred-file

To subscribe to a queue

./mms s nats-local=false --production-hub=nats-url --cred-file=path/to/credfile.cred --queue-name=queueName 

When we are subscribing to a queue, we will get all the messages that were sent in last 12 hours.

Build and run MMSd as docker container

make image
docker run -i -p 4222:4222 -p 8080:8080 mmsd

Generate code diagram

  • install go-plantuml: go get -u github.com/bykof/go-plantuml
  • make puml

Directories

Path Synopsis
cmd
mms
internal
server
Package server provides a http service struct for a events service.
Package server provides a http service struct for a events service.
pkg
mms

Jump to

Keyboard shortcuts

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