Skip to main content

Posts

Using Custom S3 Resource in Spring Batch Application - Part 2

In the last article titled Simple S3 ItemReader for Spring Batch Application, I explained how to write a custom FileItemReader for S3. You might have noticed, the solution works great but you will have to restart your application/server for any changes in the S3 file to take effect.

Here, we will try another approach where we will extend org.springframework.core.io.AbstractResource class and implment a S3 resource provider. For this, we will have to implement the below methods:
public String getDescription()public InputStream getInputStream()public boolean exists()public long contentLength()public long lastModified()public String getFilename()public URL getURL()
Let's implement these methods.
Method: getDescription()This should return a short description on the aws resource including the bucket name and the object name. StringBuilder builder = new StringBuilder("S3 resource [bucket='"); builder.append(this.bucketName); builder.append("' and key=&#…
Recent posts

Simple S3 ItemReader for Spring Batch Application - Part 1

Spring Batch is one of the most popular Open Source batch processing frameworks available today. Also it supports most advanced features such as optimization and partitioning techniques, thus makes it the most suitable framework for high volume and high performance enterprise applications.
In this article, we will discuss about using Spring batch to process files from aws S3(Simple Storage Service).

The lifecycle of a batch process is, read large chunk of data, process it and then write the transformed data back to some storage. So, the main components of a batch process are: a reader, a processor and a writer. Batch ReaderSpring Batch provides various item readers such as: FlatFileItemReaderHibernatePagingItemReaderIbatisPagingItemReaderJdbcPagingItemReaderJmsItemReaderMongoItemReaderAs you might be knowing, there is no in-built reader available for S3. You can write your own item reader by implementing the interface ItemReader. But here, I will show you how to build an item reader for S…

Tomcat fails with java.io.FileNotFoundException for Google Error Prone

Recently noticed java.io.FileNotFoundException during server startup, a closer look at the stacktrace pointed the issue with the Google Error Prone library. The jar file had a + (plus) sign in it (javac-9+181-r4173-1.jar) but in the path, this was being replaced by a space!
o.apache.catalina.core.StandardService : Starting service [Tomcat] org.apache.catalina.core.StandardEngine : Starting Servlet Engine: Apache Tomcat/8.5.29 o.t.TomcatEmbeddedServletContainerFactory : Unable to open jar '/Users/USER/.m2/repository/com/google/errorprone/javac/9 181-r4173-1/javac-9 181-r4173-1.jar' to determine if it contains static resources java.io.FileNotFoundException: /Users/USER/.m2/repository/com/google/errorprone/javac/9 181-r4173-1/javac-9 181-r4173-1.jar (No such file or directory) at java.util.zip.ZipFile.open(Native Method) at java.util.zip.ZipFile.(ZipFile.java:219) at java.util.zip.ZipFile.(ZipFile.java:149) at java.util.jar.JarFile.(JarFile.java:166) at …

[Resolved] How to Fix Moto G4 Plus Rear Camera Blurred Photo Issue

From last week, photos taken with my Moto G4 Plus phone appears blurred and hazy. First, I thought its due to obstacles on the lens, I cleared it with a soft cloth but with no luck. Compared photos taken with front and back cameras, front camera photos were sharp, thousand times better than the rear ones! It was clear there is some problem with my back camera.
As usual, I did a Google search, there were a huge number of similar complaints on Lenovo forum and other community websites. There were many solutions suggested, I tried all of them one after other.
Capture photo in Safe ModeMany of the forum members suggested to boot the phone in Safe mode and capture photos. I tried but didn't find any difference in quality.
Tip: You can enable Safe Mode by following the below steps:
Press the Power keyTouch and hold Power offTouch OK when Reboot to safe mode appears Clear Cache PartitionAnother advise was to clear the cache partition. This removes all temporary files stored by the applicati…

Tata H5X Color Variants, Exterior and Interior Designs

Tata would be launching its new OMEGA (Optimal Modular Efficient Global Advanced) architecture SUV named H5X by April 2019. No doubt, Tata's new Impact Design 2.0 philosophy car is going to rule Indian roads. There would be a 5 seater and 7 seater models available, and the pricing would be competitive, expected between 13L and 17L.








Tata Nexon Colour Variants, Interior and Exterior Designs

No doubt, Nexon is a game changer for Tata. With its stunning style along with the feature rich body keeps all its competitors far far away. From the traditional hatchback and SUV models, a hybrid model has come up, with well engineered and well architected design, we would say, this is a revolution in Indian automobile industry!



These are the colour variants of Tata Nexon available in the market. Out of these variants, only in Moroccan Blue, Vermont Red and Calgary White has the dual-tone roof option available.

Vermont Red


Moroccan Blue


Seattle Silver


Glasgow Grey


Calgary White

List of Purpose Codes for Foreign Inward Remittance to India

Banks normally ask for purpose code (also known as purpose of remittance) for all money transfers from overseas to a resident account if the amount exceeds Rs.1,00,000 (or its equivalent in foreign exchange). It is mandatory for the bank to submit these details to RBI on a regular basis.
The receiver can keep 50% of the amount (70% for exporters) in Exchange Earners Foreign Currency account (EEFC) as foreign currency itself or can convert to Indian rupees and keep it in his Resident account.


Even, most of the Adsense users were asked to submit these details as the transactions were mostly happening from Google Citibank, CA account in USD, and the most appropriate purpose code is P1007 - Advertising, trade fair service. You can find the complete list of purpose codes in the below table.
For inward remittance due to sale of Employee Stock Purchase Program (ESPP) and Restricted Stock Units (RSU), the most matching purpose code is P0021 - Receipts on account of sale of share under Employee s…