Posts

Logs Monitoring in Microservices using ELK - Architecture

Image
The ELK Stack is an amassment of three open-source products — Elasticsearch, Logstash, and Kibana. ELK stack provides centralized logging in order to identify quandaries with servers or applications. It sanctions us to search all the logs in a single place. It withal avails to find issues in multiple servers by connecting logs during a concrete time frame. The ELK stack provides a simple yet robust log analysis solution for our developers and DevOps engineers to gain valuable insights on failure diagnosis, application performance, and infrastructure monitoring. Modern log management and analysis solutions include the following capabilities: Aggregation – the facility to accumulate and ship logs from multiple data sources. Processing – the faculty to transform log messages into consequential data for more facile analysis. Storage – the faculty to store data for elongated time periods to sanction for monitoring, trend analysis, and security use cases. Analysis – the faculty to dissec

Java HashMap Example

Image
The HashMap class is roughly identically tantamount to Hashtable, except that it is unsynchronized and sanctions nulls.Java HashMap class implements the Map interface which sanctions us to store key and value pair, where keys should be unique. If you endeavor to insert the duplicate key, it will supersede the element of the corresponding key. It is facile to perform operations utilizing the key index like the update, delete, etc. As shown in the above figure, the HashMap class extends AbstractMap class and implements the Map interface, the Cloneable interface, and the Serializable interface. public class HashMap< K , V > extends AbstractMap< K , V > implements Map< K , V >, Cloneable, Serializable { Constructors of Java HashMap class 1)  public HashMap( int initialCapacity, float loadFactor) Constructs an empty HashMap with the specified initial capacity and load factor. 2)  public HashMap( int initialCapacity) Constructs an empty HashMap with the specifie

Two-Factor Authentication - Implementation - Is two-factor authentication secure?

Image
Two-factor (2FA) or multi-factor authentication (MFA) is a supplemental security layer for our business – availing to address the vulnerabilities of a standard username-password-only approach. In today’s digital environment, the rudimentary “username and password” approach to security is facile prey for hackers. Many log-ins can be compromised in minutes, and private data is under incrementing threat. Multi-factor Authentication, additionally kenned as MFA or multi-step verification, integrates another layer of security, supplementing the username and password model with a code that only a concrete utilizer has access to (typically sent to something they have immediately to hand).  Why is it required?  • Legacy Authentication & Authorization alone are not enough   • No way to verify the end-user utilizer is our authentic subscriber  • No way to verify the end-user utilizer is bound to his/her account services Implementation - High-level Overview How does two-factor authentication w

Creating Sequence Diagram using PlantUML

Image
PlantUML is an open-source implement and syntax for engendering diagrams from plain-text definitions. We utilize simple text syntax to describe a type of diagram, as well as the elements which make up the diagram, and our away. Utilizing this plain text syntax and a rendering server/plugin to convert our text into diagrams, we can draw near on any architectural diagram that we require when designing a system. Here are just a few of the types of diagrams we can engender: Sequence diagram Usecase diagram Class diagram Object diagram Activity diagram  Component diagram Deployment diagram State diagram Timing diagram Steps to create sequence diagrams    Step 1:  Download and Install Visual Studio Code : https://code.visualstudio.com/download Step 2: Add PlantUML extension for Visual Studio Code  Install the extension Step 3: Create a text file with PlantUML commands, like this example called sequenceDiagram.txt: @startuml skinparam SequenceMessageAlignment center actor User User ->

Spring REST Exception Handling Example - ControllerAdvice

Image
In this article, we will learn how to handle errors in Spring Boot REST application. Technologies used : Spring Boot 2.1.1.RELEASE Spring 5.1.3.RELEASE Maven 3 Java 8 Since Spring 3.2 brings support for an ecumenical @ExceptionHandler with the @ControllerAdvice annotation. This enables a mechanism that breaks away from the older MVC model and makes utilization of ResponseEntity along with the type safety and flexibility of @ExceptionHandler. Project Structure pom.xml <? xml version ="1.0" encoding ="UTF-8" ?> < project xmlns ="http://maven.apache.org/POM/4.0.0" xmlns: xsi ="http://www.w3.org/2001/XMLSchema-instance" xsi :schemaLocation ="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" > < modelVersion > 4.0.0 </ modelVersion > < parent > < groupId > org.springframework.boot </ groupId > < artifactId > spring

Java Lambda Expressions

Image
Lambda expressions are introduced in Java 8 and are touted to be the most immensely colossal feature of Java. A lambda expression is an innominate function. A function that doesn’t have a designation and doesn’t belong to any class. It preserves an abundance of code and provides the implementation of a Functional interface. Lambda expressions are homogeneous to methods, but they do not require a denomination and they can be implemented right in the body of a method. //Syntax of lambda expression (parameter_list) -> {function_body} Java lambda expression has consisted of three components. 1) Parameter_list : It can be vacuous or non-empty as well. 2) Arrow-token : It is utilized to link arguments-list and body of expression. 3) Function_body : It contains expressions and verbalizations for a lambda expression. Lambda Expression Example: Single Parameter interface Fruit{ public String setFruit(String fruit); } class LambdaExpressionExample { public static void main(String[] a