mirror of
https://github.com/mariocandela/beelzebub.git
synced 2025-07-01 18:47:26 -04:00
Configured tracing on rabbitMQ
This commit is contained in:
@ -5,5 +5,5 @@ core:
|
|||||||
logDisableTimestamp: true
|
logDisableTimestamp: true
|
||||||
logsPath: ./logs
|
logsPath: ./logs
|
||||||
tracing:
|
tracing:
|
||||||
rabbitMQEnabled: false
|
rabbitMQEnabled: true
|
||||||
rabbitMQURI: "amqp://guest:guest@localhost:5672/"
|
rabbitMQURI: "amqp://guest:guest@localhost:5672/"
|
||||||
|
27
main.go
27
main.go
@ -14,8 +14,7 @@ import (
|
|||||||
|
|
||||||
var quit = make(chan struct{})
|
var quit = make(chan struct{})
|
||||||
|
|
||||||
var queue amqp.Queue
|
var channel *amqp.Channel
|
||||||
var channel amqp.Channel
|
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
parser := parser.Init("./configurations/beelzebub.yaml", "./configurations/services/")
|
parser := parser.Init("./configurations/beelzebub.yaml", "./configurations/services/")
|
||||||
@ -37,16 +36,6 @@ func main() {
|
|||||||
channel, err := conn.Channel()
|
channel, err := conn.Channel()
|
||||||
failOnError(err, "Failed to open a channel")
|
failOnError(err, "Failed to open a channel")
|
||||||
defer channel.Close()
|
defer channel.Close()
|
||||||
|
|
||||||
queue, err = channel.QueueDeclare(
|
|
||||||
"event", // name
|
|
||||||
false, // durable
|
|
||||||
false, // delete when unused
|
|
||||||
false, // exclusive
|
|
||||||
false, // no-wait
|
|
||||||
nil, // arguments
|
|
||||||
)
|
|
||||||
failOnError(err, "Failed to declare a queue")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Init Protocol strategies
|
// Init Protocol strategies
|
||||||
@ -88,9 +77,19 @@ func traceStrategyStdout(event tracer.Event) {
|
|||||||
}).Info("New Event")
|
}).Info("New Event")
|
||||||
|
|
||||||
//TODO check amqp.Channe
|
//TODO check amqp.Channe
|
||||||
if queue != (amqp.Queue{}) {
|
if channel != nil {
|
||||||
eventJSON, err := json.Marshal(event)
|
eventJSON, err := json.Marshal(event)
|
||||||
failOnError(err, "Failed to publish a message")
|
failOnError(err, "Failed to Marshal Event")
|
||||||
|
|
||||||
|
queue, err := channel.QueueDeclare(
|
||||||
|
"event",
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
nil,
|
||||||
|
)
|
||||||
|
failOnError(err, "Failed to declare a queue")
|
||||||
|
|
||||||
err = channel.Publish(
|
err = channel.Publish(
|
||||||
"",
|
"",
|
||||||
|
Reference in New Issue
Block a user