<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Akhilesh Kumar</title>
    <description>The latest articles on Forem by Akhilesh Kumar (@akhileshk).</description>
    <link>https://forem.com/akhileshk</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F363737%2F2bc303eb-cbc7-4943-9798-02da1d8e77ff.png</url>
      <title>Forem: Akhilesh Kumar</title>
      <link>https://forem.com/akhileshk</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/akhileshk"/>
    <language>en</language>
    <item>
      <title>Understanding the Messaging queue in Microservices</title>
      <dc:creator>Akhilesh Kumar</dc:creator>
      <pubDate>Tue, 27 Apr 2021 19:44:09 +0000</pubDate>
      <link>https://forem.com/akhileshk/understanding-the-messaging-queue-in-microservices-4j12</link>
      <guid>https://forem.com/akhileshk/understanding-the-messaging-queue-in-microservices-4j12</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;Microservices is an architectural style that structures an application as a collection of services that are loosely coupled, highly maintainable, pluggable, and owned by small teams based on services.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Microservice architecture helps you in scaling your complex application, deploy services independently, rapid delivery of new features, and fully testable. Around microservice-based architecture, we are also able to utilize diverse tech stacks. So before starting out with your next Microservice application, you need to keep one important term in mind, i.e. Messaging Queue.&lt;br&gt;
A message queue is a form of asynchronous inter-service communication. Messages are stored on the queue until they are processed and deleted. Each message is processed only once, by a single consumer. Message queues can be used to decouple heavyweight processing, to buffer or batch work, and to smooth spiky workloads. Common messaging tools are Kafka, RabbitMQ, AWS SQS.&lt;br&gt;
Let dive into Messaging queue and learn why do we need them in a Microservice architecture.&lt;/p&gt;

&lt;h2&gt;
  
  
  Message Queue
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyz8u39fgmotb1owo60h3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyz8u39fgmotb1owo60h3.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;A message queue is a queue of messages sent between services/applications. A message is some information that is produced by a producer application in byte form, stored in a queue and is consumed by a consumer application.&lt;br&gt;
The best thing about a message queue is even when some service is offline, the message queue preserves the message in the queue and can be retrieved by the consumer.&lt;/p&gt;

&lt;p&gt;Let’s say we have a Digital Signing service SignMe. With SignMe we enable organizations to send documents to people for electronic signatures. Once someone creates a document and has to send it for signature, they need to add recipients. Now to inform recipients, we need to send them an email. We also need to send recipients a reminder to sign the documents if they forget to sign after x days. Let’s think of some approach where we can send emails to the recipients.&lt;/p&gt;

&lt;p&gt;There is one service where a sender goes and creates a template, adds recipients, and sends the envelope for signature. There is another notification service that sends the recipient notifications as email or push notifications. We want to send emails to end recipients with the help of messaging queue.&lt;/p&gt;

&lt;p&gt;We can either have a rest synchronous architecture, where we have an external call to notification service and wait for the response, or an asynchronous messaging queue.&lt;br&gt;
Synchronous call to notification service will block the current thread until the request is resolved and for any failure in the service, it will give an exception and we will lose the current process. If the goal is to support a few hundreds or thousands of users, then a simple rest synchronous architecture will be a good choice to go with.&lt;br&gt;
However, when we talk of large-scale applications where tens of thousands of requests are created, we need to use the Messaging queue.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;To send emails, how can we do it?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Our Envelope Sending service will be a publisher which pushes these notification actions to some topic of messaging queue and, respond back to the users. So once we write the message to the queue, the notification service which acts as a consumer can read messages from the queue and, process them asynchronously.&lt;br&gt;
So this is how we can achieve high reliability, scalability, and true decoupling. In certain scenarios when our dependency services are down, we still have the messages stored safely with us in the queue which we can retrieve later. Wonderful, right? Let me know your thoughts in the comments.&lt;/p&gt;

</description>
      <category>eventdriven</category>
      <category>microservices</category>
      <category>architecture</category>
      <category>distributedsystems</category>
    </item>
    <item>
      <title>Deploying React App to Github Pages</title>
      <dc:creator>Akhilesh Kumar</dc:creator>
      <pubDate>Fri, 10 Apr 2020 04:21:29 +0000</pubDate>
      <link>https://forem.com/akhileshk/deploying-react-app-to-github-pages-2jg5</link>
      <guid>https://forem.com/akhileshk/deploying-react-app-to-github-pages-2jg5</guid>
      <description>&lt;p&gt;I have been hosting my static webpages on Github and use the CNAME to point the hosted project on gh-pages on my own domain name. &lt;/p&gt;

&lt;p&gt;I am new to modern web development and have been actively exploring the Full-stack web Development recently. Earlier just pushing my static HTML, CSS and JS files to github used to deploy the static contents directly. But when I pushed the react app for the first time to my Github repository, it simply didn't publish my page. It took me no longer to understand that some other way must exist to publish the static generation from React App.&lt;/p&gt;

&lt;p&gt;Well, it’s simpler than I considered it to be. I am showing how to deploy a react app to gh-pages in no time.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Getting Started:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;I had created a Notes taking app using Firebase and React. Nothing fancy but a very good starter project to do. &lt;/p&gt;

&lt;p&gt;You must have a Github account and Git and Node installed to your system. I assume, since you are looking forward to host an existing React Application, so you must be having these installed. &lt;/p&gt;

&lt;p&gt;Moving forward, I will quickly jump to installing Github Pages Package &lt;code&gt;gh-pages&lt;/code&gt;. There are two kinds of Development Environment when working on some App.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Development Environment&lt;/li&gt;
&lt;li&gt;Production Environment&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;To practice good coding habits we take care of the Production and Development Environment and therefore we will be installing &lt;code&gt;gh-pages&lt;/code&gt; to the Development Environment.&lt;/p&gt;

&lt;p&gt;Let's quickly jump to the current working directory of our React Application and then install &lt;code&gt;gh-pages&lt;/code&gt; with the NPM package manager.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;npm install gh-pages --save-dev&lt;/code&gt; or &lt;code&gt;yarn add gh-pages --save-dev&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;This package basically creates a &lt;code&gt;gh-pages&lt;/code&gt; branch on Github and also serve our bundled react files on the branch.&lt;/p&gt;

&lt;p&gt;In any Node application, &lt;code&gt;package.json&lt;/code&gt; is used to manage the properties and dependencies of the project. Let's find the &lt;code&gt;package.json&lt;/code&gt; file in the root directory, add this line of code to your script: &lt;code&gt;"homepage": "link-to-your-repository"&lt;/code&gt;, and save. In my case it looks like this:&lt;br&gt;
&lt;code&gt;&lt;br&gt;
{&lt;br&gt;
   "name": "Notes App",&lt;br&gt;
   "version": "1.0.0",&lt;br&gt;
   "private": true,&lt;br&gt;
   "homepage": "https://akhilesh-k.github.io/notes",&lt;br&gt;
...&lt;br&gt;
}&lt;br&gt;
&lt;/code&gt;&lt;br&gt;
As I wrote earlier, I used to use my custom domain until it expired, so in case you too have a custom domain, you can add the domain the &lt;code&gt;homepage&lt;/code&gt; property.&lt;/p&gt;

&lt;p&gt;You have also noticed that inside your &lt;code&gt;package.json&lt;/code&gt; file there is script object, it basically contains the scripts our React App uses to run. &lt;/p&gt;

&lt;p&gt;Again in the &lt;code&gt;package.json&lt;/code&gt; file, let's find &lt;code&gt;“scripts”&lt;/code&gt; and add these lines there:&lt;br&gt;
&lt;code&gt;&lt;br&gt;
{&lt;br&gt;
   ...&lt;br&gt;
   "predeploy": "npm run build",&lt;br&gt;
   "deploy": "gh-pages -d build",&lt;br&gt;
   ...&lt;br&gt;
}&lt;br&gt;
&lt;/code&gt;&lt;br&gt;
It depends on you, what package manager you use, you can write &lt;code&gt;yarn run build&lt;/code&gt; too if you use &lt;code&gt;yarn&lt;/code&gt;. In my case it was &lt;code&gt;npm&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Now our script looks like this:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;"scripts": {    &lt;br&gt;
   "start": "react-scripts start",&lt;br&gt;
   "predeploy": "npm run build",&lt;br&gt;
   "deploy": "gh-pages -d build",&lt;br&gt;
   "build": "react-scripts build",&lt;br&gt;
   "test": "react-scripts test",&lt;br&gt;
   eject": "react-scripts eject"&lt;br&gt;
},&lt;br&gt;
&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;predeploy&lt;/code&gt; command basically works behind the scenes in bundling up the React App while &lt;code&gt;deploy&lt;/code&gt; command starts using the bundled app.&lt;/p&gt;

&lt;p&gt;Assuming that you have git repository initialized and Github remote added to the directory, We will now run the &lt;code&gt;deploy&lt;/code&gt; command to deploy it on Github Pages!&lt;/p&gt;

&lt;p&gt;So let's do it!&lt;/p&gt;

&lt;p&gt;In the terminal, run &lt;br&gt;
&lt;code&gt;npm run deploy&lt;/code&gt; &lt;/p&gt;

&lt;p&gt;Alternatively you could also use &lt;code&gt;yarn run deploy&lt;/code&gt; if you are Yarn guy. &lt;code&gt;deploy&lt;/code&gt; basically pushes the after build file to the &lt;code&gt;gh-pagesbranch&lt;/code&gt; on our remote Github repository.&lt;/p&gt;

&lt;p&gt;In the meanwhile we have successfully published our React App to the Github pages, don't forget to commit the code!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Godspeed&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>github</category>
      <category>react</category>
      <category>webdev</category>
    </item>
  </channel>
</rss>
