blob: 1c9bfcbc0ac4feba02e3c9ddf375f5e09e4e356a (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
package main
import (
"fmt"
"log"
"os"
"github.com/Baitinq/fs-tracer-backend/src/payload-processor/processor"
amqp "github.com/rabbitmq/amqp091-go"
)
func main() {
rabbitmq_password, ok := os.LookupEnv("RABBITMQ_PASSWORD")
if !ok {
log.Fatal("RABBITMQ_PASSWORD not set")
}
log.Println("RabbitMQ password", rabbitmq_password)
conn, err := amqp.Dial(fmt.Sprintf("amqp://user:%s@rabbitmq:5672/", rabbitmq_password))
if err != nil {
log.Fatal(err)
}
defer conn.Close()
ch, err := conn.Channel()
if err != nil {
log.Fatal(err)
}
defer ch.Close()
q, err := ch.QueueDeclare(
"hello", // name
false, // durable
false, // delete when unused
false, // exclusive
false, // no-wait
nil, // arguments
)
if err != nil {
log.Fatal(err)
}
processor := processor.NewProcessor(ch, q.Name)
processor.ProcessMessages()
}
|