https://github.com/fairyhunter13/rabbitmqclient
Rabbitmqclient is built using "fairyhunter13/amqpwrapper". This client manages publishers and consumers of RabbitMQ.
https://github.com/fairyhunter13/rabbitmqclient
amqp amqpwrapper client consumer exchange go golang producer producer-consumer publish-subscribe publisher queue rabbitmq rabbitmq-network rabbitmq-topology rabbitmqclient subscriber
Last synced: 4 months ago
JSON representation
Rabbitmqclient is built using "fairyhunter13/amqpwrapper". This client manages publishers and consumers of RabbitMQ.
- Host: GitHub
- URL: https://github.com/fairyhunter13/rabbitmqclient
- Owner: fairyhunter13
- License: mit
- Created: 2020-04-05T15:44:14.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2022-08-13T21:13:16.000Z (almost 4 years ago)
- Last Synced: 2024-06-20T11:53:39.221Z (almost 2 years ago)
- Topics: amqp, amqpwrapper, client, consumer, exchange, go, golang, producer, producer-consumer, publish-subscribe, publisher, queue, rabbitmq, rabbitmq-network, rabbitmq-topology, rabbitmqclient, subscriber
- Language: Go
- Homepage:
- Size: 67.4 KB
- Stars: 1
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
بِسْمِ اللّٰهِ الرَّحْمٰنِ الرَّحِيْمِ
السَّلاَمُ عَلَيْكُمْ وَرَحْمَةُ اللهِ وَبَرَكَاتُهُ
ٱلْحَمْدُ لِلَّهِ رَبِّ ٱلْعَٰلَمِينَ
ٱلْحَمْدُ لِلَّهِ رَبِّ ٱلْعَٰلَمِينَ
ٱلْحَمْدُ لِلَّهِ رَبِّ ٱلْعَٰلَمِينَ
اللَّهُمَّ صَلِّ عَلَى مُحَمَّدٍ ، وَعَلَى آلِ مُحَمَّدٍ ، كَمَا صَلَّيْتَ عَلَى إِبْرَاهِيمَ وَعَلَى آلِ إِبْرَاهِيمَ ، إِنَّكَ حَمِيدٌ مَجِيدٌ ، اللَّهُمَّ بَارِكْ عَلَى مُحَمَّدٍ ، وَعَلَى آلِ مُحَمَّدٍ ، كَمَا بَارَكْتَ عَلَى إِبْرَاهِيمَ ، وَعَلَى آلِ إِبْرَاهِيمَ ، إِنَّكَ حَمِيدٌ مَجِيدٌ
# RabbitMQ Client
[](https://coveralls.io/github/fairyhunter13/rabbitmqclient?branch=master)
[](https://circleci.com/gh/fairyhunter13/amqpwrapper)
[](https://goreportcard.com/report/github.com/fairyhunter13/rabbitmqclient)

The rabbitmq client is built using the [fairyhunter13/amqpwrapper](https://github.com/fairyhunter13/amqpwrapper) package.
This package can manage the topology of queue's network inside the RabbitMQ.
This package simplifies the management and usage of publishing and consuming for RabbitMQ.
# Example
This is an example how to use this package.
## Publish and Subscribe
This is an example of go code to publish and subscribe using this package.
```go
package main
import (
"fmt"
"log"
"time"
"github.com/fairyhunter13/amqpwrapper"
"github.com/fairyhunter13/rabbitmqclient"
"github.com/streadway/amqp"
)
func main() {
uriHost := fmt.Sprintf("amqp://guest:guest@%s:5672", "localhost")
conn, err := amqpwrapper.NewManager(uriHost, amqp.Config{})
if err != nil {
log.Panicln(err)
}
container, err := rabbitmqclient.NewContainer(conn)
if err != nil {
log.Panicln(err)
}
err = container.
SetExchangeName("integration-test").
Publish(
"",
"example",
*new(rabbitmqclient.OtherPublish).
SetPersistent().
SetBody([]byte("test payload")),
)
if err != nil {
log.Panicln(err)
}
var result string
testHandler := func(ch *amqp.Channel, msg amqp.Delivery) {
msg.Ack(false)
result = string(msg.Body)
}
err = container.
Consumer().
SetTopic("example").
Consume(0, testHandler)
if err != nil {
log.Panicln(err)
}
time.Sleep(2 * time.Second)
if result != "test payload" {
log.Panicf("Expected: %v Actual: %v doesn't match.", "test payload", result)
}
}
```
## Topology
For this example, see this [test code](integration_test.go) inside `TestRabbitMQNetwork` function.
# Author
**fairyhunter13**
# License
The source code inside this package is available under the [MIT License](LICENSE).