Last active
December 25, 2020 04:02
-
-
Save dhanush/94f8b0243162ccd7a7655daad3288b16 to your computer and use it in GitHub Desktop.
The publisher main method which will publish messages to multiple queues
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
func main() { | |
conn := comms.NewConnection("my-producer", "my-exchange", []string{"queue-1", "queue-2"}) | |
if err := conn.Connect(); err != nil { | |
panic(err) | |
} | |
if err := conn.BindQueue(); err != nil { | |
panic(err) | |
} | |
for _, q := range c.queues { | |
m := comms.Message{ | |
Queue: q, | |
//set the necessary fields | |
} | |
if err := conn.Publish(m); err != nil { | |
panic(err) | |
} | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment