Posts

LinuxCommandExecutor

Linux Command Executor Linux Command Executor Utility class to run linux commands from java application ProcessExecutor.java package com.codergists.util; import com.codergists.exception.ProcessExecutionException; import lombok.extern.slf4j.Slf4j; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; import java.io.OutputStreamWriter; import static java.lang.String.join; import static java.util.concurrent.TimeUnit.SECONDS; import static org.apache.logging.log4j.util.Strings.isEmpty; /** * ProcessExecutor to run list of commands and return success response. * <p> * This Singleton class executes array of commands on {@link Runtime} and wait for specified Time Period to get the * response back. * <p> * * @author tvajjala = ProcessExecutor.getInstance().execute("whoami");...

Spring Cloud API Gateway

Image
Introduction Introduction API Gateway is one of the important microservice design pattern to insulate the clients from downstream micro-services. Tip Read more about microservice design patterns here Following additional benefits that API Gateway can provide Cross cutting concerns Security Monitoring/metrics Resiliency API Governance Rate limiting for external clients, read more about stripe rate limiter Channel/Country Based Routing SSL Offloading Following scenarios enforces to have API Gateway The granularity of APIs provided by micro-services is often different than what a client needs. Micro-services typically provide fine-grained APIs, which means that clients need to interact with multiple services. Different clients need different data. example external client have limited apis to integrate where as mobile client different set of apis to integrate. Network performance is different for differ...

Spring boot Drools Integration

Image
Introduction Introduction Decision tables are a "precise yet compact" way of representing conditional logic, and are well suited to business level rules. Refer Official documentation on drools decision tables and other supported formats. Tip Drools supports managing rules in a spreadsheet format. Supported formats are Excel (XLS), and CSV. Core Components in Drools Java API The KnowledgeBuilder is responsible for taking source files, such as a DRL file or an Excel file, and turning them into a Knowledge Package of rule and process definitions which a Knowledge Base can consume. An object of the class ResourceType indicates the type of resource it is being asked to build. The ResourceFactory provides capabilities to load resources from a number of sources, such as Reader, ClassPath, URL, File, or ByteArray. Caution Binaries, such as decision tables (Excel .xls files), should not use a Reader based resource handler, whic...