Skip to content

This is a working prototype of a queuing service, with following components: ● Queue ● Writer (Producer) ● Listener (Consumer)

Notifications You must be signed in to change notification settings

AkashGit21/queuing-service

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Queuing Service

Components

  • Queue
  • Writer (Producer)
  • Listener (Consumer)

Features

  • Enqueue a JSON document into the queue. enqueue()
  • Dequeue a JSON document from the queue. dequeue()
  • Multiple producers (writers) can concurrently write in the queue. Publish()
  • Multiple consumers (listeners) can concurrently read(listen) from the queue. StartConsuming() & StopConsuming()
  • A configurable waiting time interval for the listeners when the queue is empty, before trying again to read from the queue.
  • Message generation using NewMessage() with the below format:
{
  "created" : 1651818414,
  "name"    : "go",
  "message" : "Golang is a modern programming language."
}
  • Unit and integration tests

Usage

  • Initialize all the components, i.e: Producer, Consumer or a Pool of Producers, Consumers. This can be done using NewProducer() and NewConsumer() functions in the mq package.
  • Open a queue with the desired pool size of consumers using OpenQueue() in mq package.
  • Subscribe/Add the desired set of consumers to the previously opened queue using AddConumer().
  • Once the queue is open and subscribed to, start transmitting messages using Publish() and those messages can be consumed periodically using StartConsuming().
  • At any point of time, consuming messages from the queue can be stopped via StopConsuming().

Note: A use-case has been shown in the main.go following the above steps.

References/Sources

About

This is a working prototype of a queuing service, with following components: ● Queue ● Writer (Producer) ● Listener (Consumer)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages