Exploring the Circuit Breaker Pattern for Robust Software Architecture
Programming for beginners
by
14h ago
  Circuit Breaker is a design pattern, it helps to prevent cascading failures and enables the application to handle errors gracefully.   Cascading failure Cascading failure is a scenario, where one part of the system triggers sequence of failures in other parts of the system. Let me explain it with an example.   Let me explain this with an e-commerce application. Assume the e-commerce application has the following microservices:   a. User Service This service manages all user-related information. It handles details such as the user's name, multiple delivery addresses, phone ..read more
Visit website
Get all the form parameters mapped to a name in Javalin
Programming for beginners
by
14h ago
Context#formParams("name") method return the list of form parameters by name. Example List<String> myHobbies = ctx.formParams("hobbies"); Find the below working application.   Step 1: Create new maven project ‘javalin-list-form-params-by-name’.   Step 2: Update pom.xml with maven dependencies.   pom.xml <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</model ..read more
Visit website
Assign default values to missing parameters in Javalin
Programming for beginners
by
14h ago
Using ctx.formParamAsClass("name", String.class).getOrDefault("no_name"), we can assign default values to the missing parameters. Example String name = ctx.formParamAsClass("name", String.class).getOrDefault("no_name"); Find the below working application.   Step 1: Create new maven project ‘javalin-validate-form-parameter’.   Step 2: Update pom.xml with maven dependencies.   pom.xml <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.apac ..read more
Visit website
Maximizing Efficiency, User Experience with Web Queue Worker Pattern
Programming for beginners
by
14h ago
  Web Queue Worker is a Software Design Pattern commonly used to handle Background, Asynchronous tasks. With the help of this pattern, we can decouple the task execution from the user request, and scale the application on demand.   Key Components of Web Queue Worker Pattern 1.   Queue: A queue is a data structure that holds tasks to be processed. 2.   Producer: A producer is typically the part of the web application/ Microservice that creates tasks and adds them to the queue. 3.   Consumer/Worker: The consumer is the worker that processes the tasks from ..read more
Visit website
Retrieving Form Parameters by Name in Javalin
Programming for beginners
by
2d ago
Context#formParam method return a form param if it exists, else null. Example ctx.formParam("name");   Find the below working application.   Step 1: Create new maven project ‘javalin-read-a-form-parameter’.   Step 2: Update pom.xml with maven dependencies.   pom.xml   <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> <groupId ..read more
Visit website
Handling File Uploads as Lists in Javalin
Programming for beginners
by
2d ago
Context.uploadedFiles() method return the uploaded files as a list. Example List<UploadedFile> uploadedFiles = ctx.uploadedFiles(); Find the below working application.   Step 1: Create new maven project ‘javalin-read-uploaded-files-as-list’.   Step 2: Update pom.xml with maven dependencies.   pom.xml   <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</m ..read more
Visit website
Handling Multiple File Uploads with Same Name in Javalin
Programming for beginners
by
3d ago
Using context.uploadedFiles("name") method, we can read all the uploaded files by given name. Example List<UploadedFile> uploadedFiles = ctx.uploadedFiles("myFile");   Find the below working application.   Step 1: Create new maven project ‘javalin-read-uploaded-files-by-given-name’.   Step 2: Update pom.xml with maven dependencies.   pom.xml <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"> <m ..read more
Visit website
Understanding Dual Write and Effective Strategies to Prevent the Dual Write Problem
Programming for beginners
by
3d ago
The Dual Write problem occurs when data needs to be updated in two different locations simultaneously. Dual Writes are one of the most common reasons for data inconsistencies.   Let me explain this with an example. Imagine you are working on an e-commerce platform where customers maintain a balance in their wallets. When a customer buys an item, the Purchase Microservice updates the user's balance in a database (e.g., deducting money for the purchase) and also sends a message to a queue (e.g., to initiate the delivery of the item to the customer) simultaneously.   Let's explore the v ..read more
Visit website
Implementing Dynamic Groovy Script Execution in a Spring Boot Application
Programming for beginners
by
4d ago
This post is a continuation of my previous one, where I explained how to execute a Groovy Script in Java. In this post, I will demonstrate how to build a Spring Boot application that stores scripts in an in-memory database, processes given input data with the stored script, and returns the result to the end user. How to persist the groovy scripts?   We can use persistent stores like MySQL, Cassandra, etc., to save Groovy scripts. For this demonstration, I am using an in-memory database (H2), and the table structure is as follows. create table GROOVYSCRIPT ( id integer generated by ..read more
Visit website
Javalin: A Guide to File Uploads with Example
Programming for beginners
by
4d ago
Using Context.uploadedFile("name"), we can read the content of an uploaded file with given name. Example UploadedFile uploadedFile = ctx.uploadedFile("myFile"); Find the below working application.   Step 1: Create new maven project ‘javalin-upload-a-file-demo’.   Step 2: Update pom.xml with maven dependencies.   pom.xml <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 ..read more
Visit website

Follow Programming for beginners on FeedSpot

Continue with Google
Continue with Apple
OR