From b6766dcee33747234b7649c6fbcff3d12ef072b3 Mon Sep 17 00:00:00 2001 From: Ruel Tmeizeh - RuhNet Date: Wed, 13 Nov 2024 12:56:45 -0500 Subject: [PATCH] Added README, and some minor changes. --- README.org | 4 ++++ amqpconsume.go | 3 +++ main.go | 17 +++++++++++------ 3 files changed, 18 insertions(+), 6 deletions(-) create mode 100644 README.org diff --git a/README.org b/README.org new file mode 100644 index 0000000..f96f0df --- /dev/null +++ b/README.org @@ -0,0 +1,4 @@ +* RabbitHunter +** An AMQP diagnosis tool. + +You can view AMQP events in real time, and publish a test message. diff --git a/amqpconsume.go b/amqpconsume.go index 8ccd923..a05e19c 100644 --- a/amqpconsume.go +++ b/amqpconsume.go @@ -47,6 +47,9 @@ func handleAmqpMsg(d rabbitmq.Delivery) rabbitmq.Action { if appconf.FilterEvtCat == "*" || cat == msg.EventCategory { for _, name := range msgNameFilters { if appconf.FilterEvtName == "*" || name == msg.EventName { + if appconf.LogLevel > 4 { + fmt.Println("RoutingKey: ", string(d.RoutingKey)) + } fmt.Println(string(d.Body)) } } diff --git a/main.go b/main.go index 4e6869f..7e573fc 100644 --- a/main.go +++ b/main.go @@ -1,4 +1,4 @@ -//RabbitHunter (c) 2023-, RuhNet +//RabbitHunter (c) 2023-2024, RuhNet //Author: Ruel Tmeizeh, RuhNet www.ruhnet.co package main @@ -17,7 +17,7 @@ import ( const appnameFull string = "RuhNet RabbitHunter AMQP Utility" const appname string = "rabbithunter" -const version string = "0.3" +const version string = "0.4" const serverVersion string = "RuhNet " + appname + " v" + version const website string = "https://ruhnet.co" @@ -25,9 +25,9 @@ var startupTime time.Time var myHostname, myHostnameShort string const banner = ` - ____ __ _ _ __ - / ___\ __ __/ /_ / \ / /__ __/ /_ - / /_/ // /_/ / _ \/ / \/ //__\_ __/ +--⟶____ __ _ _ __ +-⟶/ ___\ __ __/ /_ / \ / /__ __/ /_ +⟶/ /_/ // /_/ / _ \/ / \/ //__\_ __/ /_/ \_\\ ___/_/ /_/_/ \__/ \__,/_/ %s _____________________________________________________ ` @@ -62,7 +62,7 @@ func main() { // Setup initConfig() - fmt.Println("Configuration OK, starting " + appname + "...") + //fmt.Println("Configuration OK, starting " + appname + "...") logit(5, "Configuration OK, starting "+appname+"...") ///////////////////////////////////////////// @@ -160,6 +160,8 @@ func main() { logit(7, fmt.Sprintf("Message confirmed from RabbitMQ server. tag: %v, ack: %v\n", c.DeliveryTag, c.Ack)) }) + fmt.Println("Publish Exchange: [" + appconf.AmqpExchType + "] '" + appconf.AmqpPubExch + "'\nPublish Routing Key: '" + appconf.AmqpPubRoutingKey + "'") + fmt.Println("Consume Exchange: [" + appconf.AmqpExchType + "] '" + appconf.AmqpSubExch + "'\nConsume Routing Key: '" + appconf.AmqpSubRoutingKey + "'\nConsume Queue: 'consumer_rabbithunter_" + myHostnameShort + "'") ///////////////////////////////////////////// // Message Filters msgCatFilters = strings.Split(appconf.FilterEvtCat, ",") @@ -168,6 +170,9 @@ func main() { fmt.Println("Filtering event app names matching:", msgAppNameFilters) fmt.Println("Filtering event categories matching:", msgCatFilters) fmt.Println("Filtering event names matching:", msgNameFilters) + log.Println("Filtering event app names matching:", msgAppNameFilters) + log.Println("Filtering event categories matching:", msgCatFilters) + log.Println("Filtering event names matching:", msgNameFilters) ///////////////////////////////////////////// logit(6, "Using "+fmt.Sprintf("%d", appconf.AmqpWorkers)+" concurrent workers to process AMQP messages.")