Showing posts with label Microservices. Show all posts
Showing posts with label Microservices. Show all posts

Friday, June 19, 2020

10 Dos and Don’ts for getting started with Microservices

Too much noise about Microservices but still scratching your head where and how you can start? Here are the 10 Dos and Dont's.

  • Choose a simple/non-critical feature in your application, that you can afford to burn your fingers several times. Choose something like a Change Password functionality. You can develop the complete change password behaviour that involves validating the old password, accepting the new password, encrypting using BCrypt and Salt and storing them in the Database.
  • Don’t bother too much about the presentation layer. Concentrate on the core functionality and talk to the service using HTTP and exchange simple JSON data. Worry about WebComponents, Virtual DOM and the like later on.
  • Don’t develop it using the mothership technology of your project. If your project is implemented using RoR or .NET or Java implement the service using a technology other than these. For example, if your main application is built on Rails, use Spring Boot to implement the services. You can also use NodeJS.
  • Do not write more than 100 hundred lines of code to begin with. Remember it’s a microservice. Don’t make it a macro service and grow to be a giant. And that’s why we have chosen a small feature in first place.
  • Use a simple IDE like TextMate or Sublime Text or just Notepad++. Why do you need a mammoth editor that takes 5 minutes to open? In that 5 minutes you could easily complete half the service. 
  • Don’t worry about the Message Queues like RabbitMQ, Kafka etc., Do not complicate your service in the beginning itself. Keep it Simple, Stupid.
  • Learn Docker. Period. 
  • Throw away your Windows machine. Now, that’s very harsh!!! But if you want to jumpstart developing a service and quickly deploying to the cloud, please move away from the comfortable territory of Windows. Pick up a Mac or buy an Ubuntu or any Linux machine and start working.
  • Stop reading too many articles in this topic after some point. Just go ahead and implement it.

Tuesday, June 16, 2020

Two services talking using NodeJS and Ruby, Sinatra.

There are a number of ways to make services or applications talk to each other. You can make one service access another service synchronously or asynchronously.

Usually two services can talk to each other each other using databases, or plain HTTP or using message queues. Message queues are used for asynchronous communication. 

Here's a short video that shows two services, one created using NodeJS and the other created using Ruby, Sinatra. NodeJS service uses axios HTTP library to access the Ruby Service.