Skip to content

TNAucoin/gorabbit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gorabbit

Go and RabbitMQ

Exploring RabbitMQ with Go

This project consists of a few different RabbitMQ programs to explore the basics ideas around working with producers, consumers, and queues in RabbitMQ.

Producer / Consumer

graph LR;
    producer((("Sender.go")))
    queue["gorabbit Queue"]
    consumer((("Consumer.go")))
    producer --> queue --> consumer

The sender.go program is a simple producer, that sends messages to the queue named "gorabbit". The consumer.go is a simple consumer that will continually attempt to read any messages waiting in the queue "gorabbit".

Task / Worker

graph LR;
    task((("Task.go")))
    queue["task Queue"]
    worker((("Worker.go" A)))
    worker2((("Worker.go" B)))
    task --> queue
    queue --> worker
    queue --> worker2
    

The task.go program takes an argument where any N number of . represents work in terms of seconds in which the receiving worker node will wait:

go run cmd/task/task.go work...

This will result in the consuming worker node to sleep for 3 seconds, upon receiving this message.

Not much has changed from the original consumer in the first examples. The only addition for the worker.go is that we parse the number of '.' within the message to determine how long it should wait.

About

Go and RabbitMQ

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages