activeMQ

package module
v0.0.0-...-0ae37fa Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2018 License: Apache-2.0 Imports: 1 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

go-activeMQ

activeMQ client for go based on github.com/go-stomp/stomp

usage:

//Send
if err := utils.NewActiveMQ("localhost:61613").Send("/queue/test-1", "test from 1"); err != nil {
    fmt.Println("AMQ ERROR:", err)

//this func will handle the messges get from activeMQ server.
handler := func(err error, msg string) { fmt.Println("AMQ MSG:", err, msg) }
if err := utils.NewActiveMQ("localhost:61613").Subscribe("/queue/test-1", handler); err != nil {
    fmt.Println("AMQ ERROR:", err)
}

Contact Me:

Email:anjieych@126.com QQ: 272348197

Documentation

Overview

Usage:

	//Send
	if err := utils.NewActiveMQ("localhost:61613").Send("/queue/test-1", "test from 1"); err != nil {
	fmt.Println("AMQ ERROR:", err)

 //this func will handle the messges get from activeMQ server.
	handler := func(err error, msg string) { fmt.Println("AMQ MSG:", err, msg) }
	if err := utils.NewActiveMQ("localhost:61613").Subscribe("/queue/test-1", handler); err != nil {
	  fmt.Println("AMQ ERROR:", err)
	}

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ActiveMQ

type ActiveMQ struct {
	Addr string
}

func NewActiveMQ

func NewActiveMQ(addr string) *ActiveMQ

New activeMQ with addr[eg:localhost:61613] as host address.

func (*ActiveMQ) Check

func (this *ActiveMQ) Check() error

Used for health check

func (*ActiveMQ) Connect

func (this *ActiveMQ) Connect() (*stomp.Conn, error)

Connect to activeMQ

func (*ActiveMQ) Send

func (this *ActiveMQ) Send(destination string, msg string) error

Send msg to destination

func (*ActiveMQ) Subscribe

func (this *ActiveMQ) Subscribe(destination string, handler func(err error, msg string)) error

Subscribe Message from destination func handler handle msg reveived from destination

Jump to

Keyboard shortcuts

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