Posts

Docker push denied requested access to the resource is denied unauthorized authentication required

Image
Open command prompt and execute below command docker login If you have Docker Desktop installed then it will automatically get credentials otherwise you can follow steps:  click here   Ensure you have tagged the local images with the Docker account namespace - To get Docker account namespace:  click here You can change the tag using below command docker tag name-of-image docker_a/c_namespace/name-of-image Example- C:\Windows\System32>docker tag eazybytes/loans ctcsinformation/loans Finally you can push the docker images to docker hub

Right way to close HttpsURLConnetion using try with resources in java 8

HttpsURLConnection does not implement the AutoCloseable interface in Java 8 or later versions. Since HttpsURLConnection does not implement AutoCloseable, you cannot use it directly in a try-with-resources block. However, you can create a wrapper class that implements AutoCloseable and encapsulates the HttpsURLConnection object, and then use the wrapper class in a try-with-resources block. Here's an example of how to create a wrapper class for HttpsURLConnection that implements AutoCloseable: public class HttpsURLConnectionWrapper implements AutoCloseable { private final HttpsURLConnection connection; public HttpsURLConnectionWrapper(URL url) throws IOException { connection = (HttpsURLConnection) url.openConnection(); } public HttpsURLConnection getConnection() { return connection; } @Override public void close() throws IOException { connection.disconnect(); } } In this example, the HttpsURLConnectionWrapper c...

How to create dynamic steps in Spring Batch

We can create steps dynamically and return the job reference. Here is an example - @Bean public Job job() { Step[] stepsArray = // create your steps array or pass it as a parameter SimpleJobBuilder jobBuilder = jobBuilderFactory.get("mainCalculationJob") .incrementer(new RunIdIncrementer()) .start(truncTableTaskletStep()); for (Step step : stepsArray) { jobBuilder.next(step); } return jobBuilder.build(); }

Sending Bulk SMS using Sprint Boot Batch

You must use Spring Boot Batch Jobs to send the bulk SMS's.  It's very flexible to schedule these jobs using Cron expression, so you can send the SMS as per the requirement. e.g. daily, weekly or at a particular time.  We need to integrate our job with the SMS provider like - msg91 Following is the Job configuration - This class has reader which will read the data for SMS content and job defination @Configuration @EnableBatchProcessing public class SmsBatchConfiguration { @Autowired @Qualifier("smsContentReader") public ItemReader > itemReader; @Autowired @Qualifier("nenewalNotificationSMSProcessor") RenewalNotificationSMSProcessor renewalNotificationSMSProcessor; @Autowired @Qualifier("smsSender") SmsSender SmsSender; @Autowired public JobBuilderFactory jobBuilderFactory; @Autowired public StepBuilderFactory stepBuilderFactory; @Value("${renewal.batch.notifications.email}") private String email...

Git Commands -

Commands Description git status Check status git add [file-name.txt] Add a file to the staging area git add – A Add all new and changed files to the staging area git commit -m "[commit message]" Commit changes git rm -r [file-name.txt] Remove a file (or folder) git branch List branches (the asterisk denotes the current branch) git branch – a List all branches (local and remote) git branch [branch name] Create a new branch git branch -d [branch name] Delete a branch git push origin --delete [branch name] Delete a remote branch git checkout -b [branch name] Create a new branch and switch to it git checkout -b [branch name] origin/[branch name] Clone a remote branch and switch to it git checkout [branch name] Switch to a branch git checkout - Switch to the branch last ...

Git Quick Card

Image
Git – Introduction There are many popular DVCS systems like Git, Mercurial, Bazaar which has grown maturely to implement distributed revision across their products. Git is widely used by the development teams across the world due to its simplicity, active open source the development team  and frequent releases/patches. Before moving forward with the git concepts, few of them terminologies which will be frequently used in this tutorial are defined below : Remote Repository : This refers to the specific project space on the central server where the project source code is stored and will be used by the team members for checkout or commit. Local Repository (.git directory): There is a local folder “.git” which is automatically created when the project or folder is git tracked. The “.git” folder is like a local database which will contain all information related to branches, commit history, user configurations, and metadata. Branches / Tags – Has the same definition as ...

Spring batch introduction

An open source framework to create batch processing application which can deal with the high volume of data, capable to handle processing of billions of records in a day efficiently. Lightweight framework – consume very less memory. It’s not a scheduling framework Provide out of the box APIs to read, process and write data.   Efficient transaction management and e rror handling . Why does the batch job needed? Automate the complex processing (applying business logic on data/transforming data) of large volumes of data without any user interaction. Spring Batch vs Spring Boot Batch - · Spring batch is a batch processing framework and spring boot help us to do rapid development by using starter-templates (convention over configuration). What are the ideal use cases for the batch job? Reads the high volume of records from the database/file system.   Process the data e.g. Month-end / Weekend calculations Write back processed data / genera...