Posts

Showing posts from January, 2019

Maven Plugin

What are Maven Plugins? Maven is actually a plugin execution framework where every task is actually done by plugins. Maven Plugins are generally used to − create jar file create war file compile code files unit testing of code create project documentation create project reports A plugin generally provides a set of goals, which can be executed using the following syntax − mvn [plugin-name]:[goal-name] For example, a Java project can be compiled with the maven-compiler-plugin's compile-goal by running the following command. mvn compiler:compile Plugin Types Maven provided the following two types of Plugins − Sr.No. Type & Description 1 Build plugins They execute during the build process and should be configured in the <build/> element of pom.xml. 2 Reporting plugins They execute during the site generation process and they should be configured in the <reporting/> element of the pom.xml. Following is the list of few common plugins

Maven Repository

Image
What is a Maven Repository? In Maven terminology, a repository is a directory where all the project jars, library jar, plugins or any other project specific artifacts are stored and can be used by Maven easily. Maven repository are of three types. The following illustration will give an idea regarding these three types. local central remote Local Repository Maven local repository is a folder location on your machine. It gets created when you run any maven command for the first time. Maven local repository keeps your project's all dependencies (library jars, plugin jars etc.). When you run a Maven build, then Maven automatically downloads all the dependency jars into the local repository. It helps to avoid references to dependencies stored on remote machine every time a project is build. Maven local repository by default get created by Maven in %USER_HOME% directory. To override the default location, mention another path in Maven settings.xml file available a

Generating unique IDs in a distributed environment at high scale

Existing Solutions UUID UUIDs  are 128-bit hexadecimal numbers that are globally unique. The chances of the same UUID getting generated twice is negligible. The problem with UUIDs is that they are very big in size and don’t index well. When your dataset increases, the index size increases as well and the query performance takes a hit. MongoDB’s ObjectId MongoDB’s ObjectIDs  are 12-byte (96-bit) hexadecimal numbers that are made up of - a 4-byte epoch timestamp in seconds, a 3-byte machine identifier, a 2-byte process id, and a 3-byte counter, starting with a random value. This is smaller than the earlier 128-bit UUID. But again the size is relatively longer than what we normally have in a single MySQL auto-increment field (a 64-bit bigint value). Database Ticket Servers This approach uses a centralized database server to generate unique incrementing IDs. It’s like a centralized auto-increment. This approach is used by  Flickr . The problem with this approach i

Spring Security for a REST API

https://www.baeldung.com/securing-a-restful-web-service-with-spring-security https://dzone.com/articles/secure-spring-rest-with-spring-security-and-oauth2 https://www.youtube.com/watch?v=0pD7YeTAUkk https://www.youtube.com/watch?v=4x-HgnJ31cg

JMS Tutorial

Image
JMS Tutorial JMS (Java Message Service) is an API that provides the facility to create, send and read messages. It provides loosely coupled, reliable and asynchronous communication. JMS is also known as a messaging service. Understanding Messaging Messaging is a technique to communicate applications or software components. JMS is mainly used to send and receive message from one application to another. Requirement of JMS Generally, user sends message to application. But, if we want to send message from one application to another, we need to use JMS API. Consider a scenario, one application A is running in INDIA and another application B is running in USA. To send message from A application to B, we need to use JMS. Advantage of JMS 1)  Asynchronous:  To receive the message, client is not required to send request. Message will arrive automatically to the client. 2)  Reliable:  It provides assurance that message is delivered. Messaging Domains There are two