Implementing Messaging Queue NSQ in Golang using Docker

Implementing Messaging Queue NSQ in Golang using Docker

Message queues provide a new asynchronous way for services to communicate with each other. Compared to an API, a message queue has many advantages. Implementing Messaging Queue NSQ in Golang using Docker

Message queues provide a new asynchronous way for services to communicate with each other. Compared to an API, a message queue has many advantages, such as :

  • Optimize performance
  • The Producer doesn’t need to wait for the Consumer to finish their jobs thus optimizing the performance
  • Reliability
  • The level of persistence in messaging queue helps to minimalize the data loss when part of the system goes down
  • Scalability
  • Scaling the producer and consumer separately to meets your needs

1. Introduction to NSQ

Image for post

NSQ is an open source realtime distributed messaging platform which is a successor from simplequeue.

The core component of the NSQ is consist of :

  • nsqd is the daemon that receives, queues, and delivers messages to clients.
  • nsqlookupd is the daemon that manages topology information.
  • Clients query nsqlookupd to discover nsqd producers for a specific topic and nsqd nodes broadcast topics and channel information.
  • nsqadmin is a Web UI to view aggregated cluster stats in realtime and perform various administrative tasks.

A single nsqd instance is designed to handle multiple streams of data at once. Streams are called “topics” and a topic has 1 or more “channels”. Each channel receives a copy of all the messages for a topic.

Both topics and channels are not pre-configured. Topics are created on first publish on the named topic or by subscribing channel on the named topic. Channels are created on the first use of subscribing to the named channel.

and both buffer data independently of each other.

nnel generally does have multiple clients connected and each message will be delivered to a random client

nsq golang docker go

Bootstrap 5 Complete Course with Examples

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Building a simple Applications with Vue 3

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

What's new in the go 1.15

Go announced Go 1.15 version on 11 Aug 2020. Highlighted updates and features include Substantial improvements to the Go linker, Improved allocation for small objects at high core counts, X.509 CommonName deprecation, GOPROXY supports skipping proxies that return errors, New embedded tzdata package, Several Core Library improvements and more.

Docker Explained: Docker Architecture | Docker Registries

Following the second video about Docker basics, in this video, I explain Docker architecture and explain the different building blocks of the docker engine; docker client, API, Docker Daemon. I also explain what a docker registry is and I finish the video with a demo explaining and illustrating how to use Docker hub.

Go Tutorial (Golang) - Looping Constructs in Golang | Golang For Loop

In this video we will see the Looping Constructs in Golang. Golang For Loop. Go is an open source programming language which was originally developed by Google. In this Go Tutorial we will Learn Go from the Basics with Code Examples. Go is a statically-typed language.

Golang Array Example | Arrays in Go Tutorial Explained

Golang array is a fixed-size collection of items of the same type. The items of an array are stored sequentially and can be accessed using their index.

Go Tutorial (Golang) 18 - tags in Golang | How To Use Struct Tags in Go

Go struct tags are annotations that are shown after the type in a Go struct declaration. Golang tag for a field allows us to attach meta-information to the field which we can acquire using reflection