1
0
mirror of https://github.com/eventials/goevents.git synced 2025-04-24 13:48:53 +08:00
Guilherme Emilio Raduenz 74b5d89d4e
Merge pull request #41 from skrater/master
SNS producer
2018-08-21 11:38:33 -03:00
2018-08-21 11:26:14 -03:00
2018-08-21 11:26:14 -03:00
2016-12-01 10:52:22 -02:00
2018-08-15 17:14:00 -03:00
2016-12-01 16:19:05 -02:00
2018-06-15 10:40:03 -03:00
2016-11-25 16:25:27 -02:00

goevents Build Status GoDoc Go Report Card

Go messaging library

About

goevents allows to dispatch events between applications.

An application produces events based on actions. Another application consume these events and maybe create new events.

Scenario: If an application produces an event "payment.received", another application may want to delivery the product to the buyer.

Supported Transport

  • AMQP

How to use

The consumer

conn, err := NewConnection("amqp://guest:guest@127.0.0.1:5672/")

if err != nil {
    panic(err)
}

c, err := NewConsumer(conn, false, "events-exchange", "events-queue")

if err != nil {
    panic(err)
}

c.Subscribe("object.*", func(body []byte) bool {
    fmt.Println(body)
    return true
})

go c.Consume()

conn.WaitUntilConnectionClose()

The producer

conn, err := NewConnection("amqp://guest:guest@127.0.0.1:5672/")

if err != nil {
    panic(err)
}

p, err := NewProducer(conn, "events-exchange", "events-queue")

if err != nil {
    panic(err)
}

err = p.Publish("object.my_action", []byte("message"))

if err != nil {
    panic(err)
}
Description
No description provided
Readme MIT 2 MiB
Languages
Go 99.1%
Dockerfile 0.9%