In modern architecture, applications are decoupled into smaller, independent building blocks that are easier to develop, deploy and maintain. Publish/Subscribe (Pub/Sub) messaging provides instant event notifications for these distributed applications.

There are three main components to the Publish-Subscribe Model: publishers, event bus/broker and subscribers. A Publish-­Subscribe Architecture is a messaging pattern where the publishers broadcast messages, with no knowledge of the subscribers. Similarly the subscribers ‘listen’ out for messages regarding topic/categories that they are interested in without any knowledge of who the publishers are. The broker transfers the messages from the publishers to the subscribers.

Publisher Subscriber Architecture

Its enough talking let's get…


In APIs, idempotency is an important concept while implementing a payment system. An idempotent endpoint is one that can be called any number of times while guaranteeing that the side effects will occur only once. In terms of the payment system, it prevents multiple debits from the same account during failures.

The Problem

Let's discuss the problem first. Whenever we have payments in our system, we need to take care of various scenarios such as payment failures, request timeout and catastrophic events.

Let's say Client A is making a payment. Client A will make a request to a server for debit from…


Any computer system in today’s world generates a very high amount of logs or data daily. As the system grows, it is not feasible to store the debugging data into a database, as they’ve are immutable and it’s only going to be used for analytics and fault resolution purposes. So organisations tend to store it in files, which resides in local disks storage.

We are going to extract logs from a .txt or .log file of size 16 GB, having millions of lines using Golang.

Lets Code…!

Let’s open the file first. We will be using standard Go os.File

Ohm Patel

A computer science graduate, amateur Blogger and a geek who is highly competitive and strive to learn new technologies and skills by travelling the world.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store