Wednesday, October 15, 2025

Java Performance Optimization for High-Volume Search Applications

 

Imagine a search box that must sweep billions of records across more than fifty data sources and still answer in under three seconds while thousands of people are clicking at once. That is the everyday reality for public unclaimed property lookups. Latency here is not a vanity metric. Ten seconds feels like forever, and thirty seconds often means a user gives up and never finds the money that could cover rent, tuition, or medical bills. Java can handle this scale, but large datasets, legacy endpoints, and network drag can slow even well-written code. The question is blunt: how do you deliver Google-like speed on top of upstream systems that were never designed for it? Below is a practical playbook drawn from turning a single-state search that took more than thirty seconds into a fifty-state sweep that lands under three seconds, with lessons you can reuse in any high-volume Java search.

Java performance in a cup: profile, optimize, repeat.

Understanding the Performance Bottlenecks

Database Query Time

This is commonly the most significant slice. The usual culprits are missing or weak indexes, joins that force full scans, overgrown subqueries, and servers that are starved for CPU, memory, or I O. Shape access paths to exploit indexes, and verify with execution plans rather than hunches.

Network Latency

Parallel calls help, but round-trip calls to external databases, slow links into legacy data centers, API rate limits that serialize requests, repeat DNS lookups, and SSL or TLS setup costs all add up. Minimize handshakes, coalesce requests, and reuse connections aggressively.

Data Processing Time

Large XML or JSON payloads must be parsed, validated, transformed, deduped, fuzzy-matched for names, and ranked. Streaming parsers, compact payloads, and careful algorithm choices trim this section.

Application Overhead

Heavy object churn, the wrong collections for the job, noisy logging, synchronous waits, and needless copying waste CPU. Favor allocation light patterns and keep the hot path small.

Measurement is Critical

You cannot optimize what you cannot see. Use profilers like VisualVM, JProfiler, or YourKit, plus APM, to find real hotspots under realistic load. Optimize only what measurements justify.

Common Misconceptions

Developers often assume the database is always at fault. Optimization without measurement can make things worse. Tricks that worked for thousands of rows rarely scale to billions.

Database Optimization Strategies

Indexing Strategy

Indexes move the needle the most. Build composite indexes that mirror user queries, for example, last name, first name, and state. Use covering indexes so the engine reads the needed columns straight from the index. Do not over-index because extra indexes slow writes and bloat storage.

Query Optimization

Reshape queries so the planner can choose indexes. Replace broad ORs with UNION where it improves index use. Remove joins by selectively denormalizing hot read paths. Avoid SELECT* and fetch only needed columns. Cap transferred rows with LIMIT or TOP for first page delivery. Use engine hints only when profiling proves a gain.

Connection Pooling

Creating connections is expensive. Use a fast pool such as HikariCP and size it deliberately. A helpful first guess is pool size equals core count times two plus effective spindle count, then refine using production metrics.

Read Replicas

Split reads from writes. Direct search traffic to read replicas and keep the primary focused on writes. Read heavy systems see immediate throughput gains with minimal code changes.

Batch Processing

When scanning many jurisdictions, batch lookups are used. One request carrying ten searches can replace ten separate round-trip searches and cut network overhead dramatically.

Database Caching

Enable query result caching where appropriate and tune it using actual hit rates. Popular names repeat, so cached answers land instantly and reduce load.

Application Level Optimization

Concurrency

Never query fifty states one by one. Use CompletableFuture or virtual threads in Java 21 to issue calls in parallel and then compose results. Total time approaches the slowest upstream, not the sum of all.

Caching Layers

Adopt a three-tier model. L1 is an in-process cache with Caffeine for microsecond access on hot keys. L2 is a distributed cache with Redis, so instances share hits. L3 is an edge cache or CDN for static payloads and precomputed common results. Choose TTLs based on the upstream refresh cadence. For many public datasets, a daily or weekly refresh is adequate.

Pagination and Lazy Loading

Return the first page immediately and stream further pages. Perceived speed rises even if total work stays the same.

Object Reuse

Pool expensive objects. You already have pool connections and threads. Extend that mindset to parsers, mappers, and buffers to cut allocation churn and GC pressure.

Garbage Collection Tuning

Favor low-latency collectors like G1GC or ZGC for interactive search. Tune heap size and GC threads guided by profiling under realistic load. The goal is brief, predictable pauses.

Implementing these tactics at scale changed outcomes. Platforms like Claim Notify issue parallel queries across more than fifty state data sources, serve millions of lookups from layered caches, and hold response times under three seconds even across billions of records. This demonstrates that Java can feel consumer-grade while wrangling messy, massive datasets.

Asynchronous Processing

Move expensive enrichment to background workers via Kafka or RabbitMQ. Deliver fast first page results and notify users when deep scans complete.

Resource Hygiene

Close streams and sockets with try-with-resources. Track open file descriptors and database handles. Small leaks become production fires under real traffic.

Real World Performance Results

Before Optimization

A single state search took thirty to forty-five seconds. A full multi-state pass would have taken more than twenty-five minutes. Concurrency collapsed near a dozen users before timeouts. Database CPU pegged in the high eighties to mid-nineties. The JVM threw intermittent out-of-memory errors. There was no caching.

After Optimization

A single state search takes between half a second and one second. A comprehensive fifty-state search returns in two to three seconds. The system handles more than one thousand concurrent users without degradation. Database CPU averages in the twenties to forties. Memory is stable. Cache hit rate reaches seventy-five to eighty percent, which slashes query volume.

Performance Metrics That Matter

P50 latency sits near 1.2 seconds, P95 near 2.8, and P99 near 4.5. Throughput reaches roughly five hundred searches per second with an error rate under 0.1 percent. Infrastructure cost drops about sixty percent, helped by a seventy percent reduction in database queries due to caching.

Monitoring and Continuous Improvement

What to Track

Watch latency percentiles, slow query logs, cache hit and miss patterns, heap usage, GC pauses, thread counts, upstream API times, and timeout or error rates. Use APM tools, query analyzers, load testing with JMeter or Gatling, and alerts that trigger on percentile shifts rather than averages. Profile production traffic regularly, A/B test changes, and keep current with Java runtime improvements.

Performance as a Feature

Measure first and cut second. Databases deliver the biggest early wins through indexing, query shaping, pooling, replicas, and batching. Parallelism collapses wall time from the sum to the max. Caching multiplies speed and reduces cost. Continuous monitoring preserves the gains. Platforms like ClaimNotify show that disciplined, data-guided engineering lets Java deliver consumer-grade speed on top of complex public data. Start by baselining your system, fix the loudest bottleneck, and repeat. Share the tuning tactics and surprises you discover so the community can push the craft forward.


Saturday, March 8, 2025

Best Java Libraries for XML Data Processing




Users continue to rely on XML (eXtensible Markup Language) for data exchange and storage across Java applications because it delivers adaptable structures for complex information representation. XML demonstrates wide industry application because of its platform-independent format that produces human-readable content. 


However, the processing of XML data requires careful management due to its difficulties including efficient parsing of big files and database storage consistency with data integrity and fast data transformation.

Top Java Libraries for XML Processing



The selection of a library depends on two factors: the level of task complexity and the set criteria for system performance. 

Saturday, March 1, 2025

Upgrading to Java 21 and Spring Boot 3: A Comprehensive Guide

The transition from Java 17 to Java 21, paired with an upgrade to Spring Boot 3, is a transformative step for modern application development. This blog post shares the detailed insights, challenges, and solutions from upgrading various services and Lambda functions to these latest versions. We’ll explore the evolution of dependencies, dive into troubleshooting steps, discuss resolutions for common issues, and provide actionable takeaways to help you succeed in your own upgrade journey.

Overview of the Upgrade

The upgrade process entailed moving applications from Java 17 to Java 21 and aligning them with Spring Boot 3. This wasn’t a simple plug-and-play operation—it required careful updates to dependencies, adjustments to configurations, and tweaks to codebases to ensure everything worked harmoniously with the new versions. The process touched multiple components, including core services and AWS Lambda functions, each requiring its own set of changes.

Dependency Evolution

The upgrade unfolded in stages, with dependencies evolving iteratively as issues surfaced and were resolved. Here’s how the key components changed over time:

Java: Initially running on version 17, the leap to Java 21 introduced a "Major version 65" issue, signaling bytecode incompatibility with older tools. This necessitated updates to other dependencies to align with Java 21’s requirements.

Gradle: Starting at version 7.2, we upgraded to 8.1 early in the process to leverage its improved features and compatibility with Java 21. However, this shift triggered initial compile errors, which we addressed as part of broader dependency updates.

Spring Boot: We began with version 2.7.3 but quickly encountered limitations. An intermediate step to 2.7.18 resolved some issues, but JUnit and acceptance test failures persisted. The final move to Spring Boot 3.3.3 was essential to fully support Java 21 and handle the significant shift from javax to jakarta namespaces.

AWS SDK v1: Version 1.12.139 was in use initially, but it proved incompatible with Java 21. We phased it out entirely, relying instead on AWS SDK v2.

AWS SDK v2: Starting at 2.17.162, this remained stable throughout the upgrade, though we later validated its compatibility with the final configuration.

LocalStack: We started with version 1.17.1 for local testing. As issues emerged with Spring Boot 3, we upgraded to 1.20.1 and eventually aligned the LocalStack Docker image to version 3.0.0 for better test reliability.

LocalStack Docker: The initial version, 0.14.0, was outdated for our needs. Upgrading to 3.0.0 ensured compatibility with the updated LocalStack and Spring Boot 3.

Lombok Plugin: Version 6.4.3 caused compile errors with Java 21. Upgrading to 8.10 resolved these issues and ensured smooth integration with the new Java version.

AWS Spring: We began with version 2.4.4, which worked with Spring Boot 2.x. The move to Spring Boot 3 required an update to version 3.1.1 to maintain AWS integration.

Spring Cloud AWS Messaging: Also at 2.4.4 initially, this dependency was ultimately removed as we streamlined our AWS interactions with SDK v2.

Each step in this evolution addressed specific pain points—whether it was compilation failures, test issues, or runtime errors—bringing us closer to a fully functional Java 21 and Spring Boot 3 setup.

Known Issues and Solutions

Throughout the upgrade, several issues emerged that required targeted solutions. Here’s a detailed look at what we encountered and how we resolved them:

1. PortUnreachableException Spamming Logs

Issue: After the Spring Boot upgrade, logs became inundated with errors like:

java.net.PortUnreachableException: recvAddress(..) failed: Connection refused

Cause: This stemmed from a StatsD configuration mismatch introduced by Spring Boot’s updated metrics handling.

Solution: We updated the configuration key from management.metrics.export.statsd.enabled to management.statsd.metrics.export.enabled and explicitly enabled it in the application’s YAML file:

management:

  statsd:

    metrics:

      export:

        enabled: true

This adjustment silenced the log spam and restored proper metrics behavior.

2. Container Privileged Mode

Issue: Running containers in privileged mode clashed with Docker’s user namespaces, causing failures during testing.

Solution: We disabled Testcontainers’ Ryuk resource reaper by setting an environment variable:


TESTCONTAINERS_RYUK_DISABLED=true

This workaround allowed our tests to run smoothly without requiring privileged mode adjustments.

3. Gradle Job Dependency

Issue: A task responsible for running the application failed because it implicitly relied on the output of a jar task without declaring a dependency. The error message highlighted this misconfiguration:


Task uses this output of another task without declaring an explicit or implicit dependency.

Solution: We modified the build.gradle file to explicitly declare the dependency:

afterEvaluate {
    tasks.named('forkedSpringBootRun') {
        dependsOn ':jar'
    }
}

This ensured tasks executed in the correct order, resolving the build failure.

4. Missing AWSCredentials

Issue: After removing AWS SDK v1, we encountered a NoClassDefFoundError: com/amazonaws/auth/AWSCredentials error, indicating a lingering dependency mismatch.

Solution: We updated the LocalStack Docker image to localstack/localstack:3.0.0 and refreshed the Testcontainers dependencies in build.gradle:

testImplementation 'org.testcontainers:localstack'
testImplementation 'org.testcontainers:testcontainers'

This aligned our local testing environment with the updated AWS SDK v2 setup.

5. Acceptance Test Failures

Issue: Acceptance tests failed due to a missing AmazonSQSAsync bean, disrupting validation of AWS SQS interactions.

Solution: We added the spring.cloud.aws.sqs.endpoint property to the configuration and updated the Docker entry point to support Java 21. This restored the bean’s availability and fixed the tests.

public LocalStackContainer create() {
    try (LocalStackContainer localstack =
        new LocalStackContainer(DockerImageName.parse(IMAGE_NAME))
            .withExposedPorts(EXPOSED_PORT)
            .withServices(DYNAMODB, SNS, SQS)
            .withCopyToContainer(forClasspathResource(INIT_LOCALSTACK_SH, 0775),"/etc/localstack/init/ready.d/init-localstack.sh")
            .waitingFor(
                Wait.forLogMessage(LOG_MARKER, 1).withStartupTimeout(Duration.ofMinutes(1)))) {

      return localstack;
    }
  }

Conclusion

Upgrading to Java 21 and Spring Boot 3 is a complex but rewarding endeavor. By navigating challenges like log spam from PortUnreachableException, Gradle task misconfigurations, and AWS SDK transitions, you can modernize your applications for improved performance and maintainability. This guide offers a detailed roadmap to help you avoid common pitfalls and achieve a successful upgrade.

Tuesday, March 19, 2024

Simplifying Docker Deployment with PM2

As you know, PM2 is a daemon process manager that allows you to keep applications online. Many times, you may be running your service inside a Docker image. The service can be written in any language, such as Node.js, Java, etc. Below is the shell script that can be used to deploy your service. It can be added and used in your CI/CD pipeline.


Sunday, December 31, 2023

AWS - Get quicksight embed url using JavaScript SDK V3

In the realm of data-driven solutions, AWS QuickSight offers a robust platform for crafting dynamic and insightful dashboards. Embedding these dashboards directly into your applications adds a layer of accessibility and convenience. This guide walks you through the process of obtaining a secure QuickSight embed URL using JavaScript SDK V3, suitable for both Node.js backend and Lambda functions. Before proceeding, ensure your QuickSight dashboard is created and shared with the intended audience.

Prerequisites:

Make sure you've completed the following preliminary steps:

Dashboard Setup:
    
Create your QuickSight dashboard and Share the dashboard with all users in your AWS account.
Open the published dashboard and choose Share at upper right. Then choose Share dashboard.



















Domain Whitelisting:

Whitelist the domain where you plan to embed the QuickSight dashboard

    









Friday, June 2, 2023

Docker - err: exec: "docker-credential-desktop": executable file not found in $PATH, out: ``

Introduction:

Docker has revolutionized the way we package, distribute, and deploy applications. However, like any other technology, it is not immune to errors and issues. One such error that I encountered recently while working with Docker on my Mac was the "error getting credentials - executable file not found" error. In this blog post, I will share my experience with this error and provide a solution that worked for me.

The Error:

When attempting to build a Docker image or perform a Docker login, I encountered the following error message:


openjdk:17: error getting credentials - err: exec: "docker-credential-desktop": executable file not found in $PATH, out: ``


Error saving credentials: error storing credentials - err: exec: "docker-credential-desktop": executable file not found in $PATH, out: `` 


Diagnosis:

The error message suggests that the Docker daemon was unable to locate the "docker-credential-desktop" executable file in the $PATH environment variable. This executable is responsible for retrieving Docker credentials and authentication.

Wednesday, April 19, 2023

React simple rich text editor using draft-js

This React Simple Rich Text Editor is created using the Draft.js library and includes button controls made with react-icons. It allows users to toggle between different inline styles like block, italic, and underline, as well as block types such as header-one, unordered-list-item, and ordered-list-item. The controls buttons are selected on text click, making it easy for users to format their text. 

The component requires two packages to be installed

yarn add draft-js react-icons

Thursday, February 23, 2023

Caused by: java.lang.UnsupportedOperationException: PermittedSubclasses requires ASM9

After attempting to upgrade Spring Boot from version 2.7.3 to version 3.0.2, I encountered this error. I spent a few hours searching on Google to try to figure out the cause of the error. Eventually, I realized that the error was related to the version of Gradle that I was using. At the time, I had been using Gradle version 7.3.3. However, once I updated to Gradle version 8.0.1, the error was successfully resolved.


I also updated distributionUrl in gradle-wrapper.properties as shown below
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.1-bin.zip

Note - After above changes i removed .idea folder and restarted my intellij

Friday, February 3, 2023

Java thread synchronization

Do you know what is thread synchronization Java? Have you ever thought about how to use synchronized in Java? let us gain some knowledge about thread synchronization Java & try to find out the answer to what is thread synchronization in Java.

But before we start writing about thread synchronization Java & try to find out how to use synchronized in Java. Let us first try to understand the policy of synchronization from one daily life example.

Assume one daily life scenario.

Suppose in your school, there is one toilet for the gents. Now, at the same time, you & your friend need to access the toilet. In both cases, the matter is an urgent one. So, you are not ready to let him go. Neither of your friends is ready to let you go. As a result, there is a mess in front of the toilet.

So, what you will do in such a case? Or what your friend will do at that time?

So, you called the teacher to solve the situation that arise there. Your teacher will draw a solution & allow anyone to go to the toilet first. And as a teacher is a respected person both of you are ready with the solution. In this case, the teacher helps to solve the conflict.

The same thing happens in thread synchronization Java. When two different parts of the program try to access the same resources then this trouble arises. We will try to know more about it when we discuss what is thread synchronization in Java.

What Is Thread Synchronization in Java:

Java is an important programming language. Java is used in the corporate world as it helps to solve real-life problems very easily. Java is used for game development purposes. These along with an operation some more processes are going on. For implementing that situation, Java programming language used the thread concept. Thread is a special concept of the Java programming language. It helps to execute more operations a t same time.

Synchronization means collaborating two or more processes at the same time. The thread synchronization Java is quite like this. Now, sometimes when two or more processes are using the same resource then there will be a problem. This problem arises when we use thread in Java. Two or more parts of the code want to use the same resources. Then there is a mess at that point.

The main goal of thread synchronization in Java is to remove the problems related to resources. If two or more parts want to use the same resource, then one by one they will execute that. This means one part will use that resource, then it will be removed. After that, another part is going to use the resource & will be removed. This is a very problematic situation. To come out of this situation, we used the 'synchronized' keyword.

Synchronize is like the teacher at your school. It helps to remove the conflicts between two or more parts for using the same recourses. We will find out more about this when we implement the thread synchronized Java. Similarly, when you are stuck at Java coding you can use Java Assignment Help Services from codingzap.

Why Should We Use Thread Synchronization Java:

Now, after knowing about thread synchronization Java, we need to know why we should use it. This is a very important topic. Often, we find out that, the threads that are implemented in the program are not executing the same we want. In those cases, we need to use this method. As there is a problem related to the synchronization.

If we don't use synchronization, then there will be an issue related to the memory space. Also, the flow of the output of the program will not be similar as desired. There will be a thread interface problem if we don't use synchronization at the correct time. When we implement thread synchronization Java, it will be easy to understand.

Tuesday, April 5, 2022

Docker - Springboot and mysql image example

A simple docker example using springboot and database as mysql/mariadb

Create springboot image

Get the completed springboot source code on github for hello-docker image

1. Create docker image

    cd hello-docker
  docker build --tag hello-docker .

2. Tag the image
    
    docker tag hello-docker madan712/hello-docker:v1.0 

Run individual container(s) in a docker network

Since springboot application need to connect to database, both the containers should be present in same docker network.

1. Created docker network

    docker network create mynetwork

2. Run database image in docker network

    docker run -d --name mysqldb -p 3306:3306  -e MYSQL_ROOT_PASSWORD=pass123 -e MYSQL_DATABASE=mydb --network mynetwork mysql

3. Run springboot application

    docker run -d --name hello-docker -p 8080:8080 -e SPRING_DATASOURCE_URL="jdbc:mysql://mysqldb:3306/mydb?useSSL=false" -e SPRING_DATASOURCE_USERNAME=root -e SPRING_DATASOURCE_PASSWORD=pass123 --network mynetwork madan712/hello-docker:v1.0

Run multi-container docker application using docker compose

docker-compose.yaml


Compose command

docker-compose up -d

Please find complete github code - hello-docker

Wednesday, February 9, 2022

React native swipe gestures handler example

This is a simple 2048 game demonstrates how to use gestures handler in react native


It is hosted in play store, feel free to install and see the demo

It is using npm react-native-swipe-gestures package to detect swipe. this component can be used handling swipe gestures in up, down, left and right direction.

Here is the complete github code link

https://github.com/madan712/2048

Code snippet


Sunday, January 30, 2022

React native draggable and swipeable list

This is a simple todo app demonstrates how to create a draggable and swipeable list in react native

An open source todo app hosted in google play store. Feel free to download and play with it.


Here is the complete github code link

https://github.com/madan712/simple-todo-app

Code snippet


Friday, December 24, 2021

Why Higher Learning Institution Prefer to Teach Java Than Python


Python and Java are two of the most widely used programming languages. Due to its computability, Java is typically more efficient than Python. Python's syntax is simpler and more succinct than Java's since it is interpreted. Using less code than Java, it can do the same thing. However, large number of students, programmers, professors in most reputable universities spend much time training java.

Much of Java's efficiency is due to its Just-In-Time (JIT) compiler and its ability to handle concurrency. The JIT compiler is a component of the Java Runtime Environment. Compiling byte-codes into native machine code "just in time" to execute Java applications enhances their performance. The Java Virtual Machine (JVM) directly calls the built code. Compiling does not use a lot of resources since the code does not have to be parsed. This could theoretically make a Java program as quick as a native application.

Another reason making java most popular among students looking for programmingassignment help online is due to its user friendliness especially when doing the coding part. Bugs, errors, and all other issues affecting the code are clearly indicated in the runtime, not like in python. Programmer errors in Python are not discovered until the code is executed. This might lead to operational failures and a longer turnaround time, which is not ideal. Object mutation is impossible in Java, although it is feasible in Python. This leads to the creation of secure software. Fixing bugs is an hectic task, that may make programmers and students look for programming help online and bestwebsites offering programming assignment help.

Python may be more flexible and user-friendly than Java, but Java is still the best "formal" language out there. It is statically typed, has all of the OO implementation bells and whistles, and tends to function in a manner that rewards proper program design. That makes it a great choice for teaching at the college and university levels. Computer Science students find it difficult to spend much time in the laptop while avoiding some best moments as a college student. However, with good programmingassignment service, such as ThePandaPapers, students may now get professional help with all sort of programming tasks, may it be java, sql, or python. They have programming assignment experts

Sunday, September 26, 2021

Java JSON Web Tokens example

 What is JSON Web Token?

JSON Web Token (JWT) is an open standard (RFC 7519) that defines a compact and self-contained way for securely transmitting information between parties as a JSON object. For more details, click here.



In this example, User object is encrypted to jwt also validating it and decrypting token to user object again. For complete github source code, click here

JwtTokenService.java

Saturday, June 13, 2020

Client side load balancing using Eureka and Ribbon

Traditional server side load balancer has some drawbacks. It requires an additional hop from client to load balancer and then load balancer to service. Also there is a burden to run and manage load balancer itself. Client side load balancer is the solution to overcome these problems. In this architecture there is an addition inbuilt load balancer component that resides inside client.

In this example we will see how client side load balancer works with eureka discovery server.



1. When service (discovery client) boots up it registers itself with discovery server. Multiple instances register itself with discovery server. Here spring.application.name is use to identify a particular service

2. Client application will also resister itself to discovery client to find instance for load banacer

3. Now load balancer within client can find the service with the help of service name

Please find complete codes from github repository -


Discovery server code -

Ribbon service code -

Ribbon client code -

Sunday, June 7, 2020

Server side load balancing using Eureka and Zuul

Routing is an important part of a microservice architecture. In real time cloud application, service instances are added/removed dynamically based on requirement and availability in such scenario its very important to manage traffic load. In the following example you will see how to use Zuul API Gateway to enable sever side load balancing of your RESTful Web Services.

Request flow -

1. When service boots up it registers itself with discovery server. Multiple instances register itself with discovery server. Here spring.application.name is use to identify a particular service

2. Zuul gateway also registers itself with discovery server. Remember Zuul gateway is also a discovery client

3. When client sends request to zuul gateway for a particular service, Zuul gateway queries discovery server to fetch available healthy instance of the service and then accordingly send request to that service.

Please check previous example on Discovery Server.

Discovery code -

Wednesday, June 3, 2020

Spring cloud service discovery example

Real time cloud application consist of a large number of micro services communicating with each other. Service instances are added/removed dynamically based on requirement and availability. Service discovery is the process of one service dynamically discovering the network location (IP address and port) of another service without hard coding their location.


Steps involved in service discovery

1. Service registers location - when service boots up it registers itself with discovery server

2. Client looks for service location - When client needs to hit a particular service first it goes to discovery server for its location

3. Discovery server sends back location - Discovery server sends the active location of the particular service

4. Client request service at location - This is a normal request to the service

5. Service sends response - Service responds to client accordingly

Example -

Started eureka server on default port 8761 and Started 2 instances of Application service on 8081 and 8082




Sunday, May 31, 2020

Spring boot ActiveMQ example

ActiveMQ Setup

Download the latest version of ActiveMQ from below link

https://activemq.apache.org/components/classic/download/



Extract the zip file, go to bin folder and start activemq server using activemq.bat

In my case it is
apache-activemq-5.15.11/bin/win32/activemq.bat

Verify ActiveMQ server is UP and running

http://localhost:8161/


Note - You can change the default port 8161 by updating below file
apache-activemq-5.15.11/conf/jetty.xml

Go to admin page

http://localhost:8161/admin/

Login with default credentials

Username - admin
Password - admin



Note - You can change default credentials by updating below file
apache-activemq-5.15.11/conf/jetty-realm.properties

Here is how our data will flow


Sunday, July 28, 2019

React with Redux authorization workflow example (react-router-dom v6)

This a simple React example which demonstrates how to restrict access to routes to authenticated users.

Complete source code can be found in GitHub -
https://github.com/madan712/auth-workflow

Below packages are used in this example -
  • React router - React Router is used to manage navigation in react application
  • Redux - Redux is used to manage state of react applications
  • react-router-dom v6 - React routing library
  • react-bootstrap - React-Bootstrap is a complete re-implementation of the Bootstrap components using React
  • react-redux-toastr - Used to show alert messages
  • Webpack - Webpack is used to create prod ready build which can be used to deployed in production
  • Babel - Babel is used to convert ECMAScript 2015+ code into a backwards compatible version of JavaScript in current and older browsers or environments

About the example - We have a landing page i.e public page which can be viewed by anyone. As this is a public page, user need not required to go through any sort of authorization


Our private page is a restricted page. If user clicks on private page link, user is taken to login page where user is asked to enter user name and password