Sending Email Using SMTP (Approach 1)

In this post under Java Mail. I will show with an example how to send email using Java api and SMTP protocol. Note: For this example and other examples in future we need to have 1) Gmail account 2) GMail SMTP server address 3) Stop the antivirus software running on your local. 4) Create an…… Continue reading Sending Email Using SMTP (Approach 1)

Excluding exceptions from skipping

In my previous posts under Spring Batch, I showed that when reading, processing or writing records in a batch, exceptions can be thrown, we can skip them and move on to next record. This is done with xml configuration as shown below 1 <batch:job id=”importEmployees”> 2 <batch:step id=”readWriteEmployees”> 3 <batch:tasklet> 4 <batch:chunk reader=”reader” writer=”writer” commit-interval=”50″…… Continue reading Excluding exceptions from skipping

Sending JMS messages in a Transaction

In this post under JMS, I will explain how to send JMS messages in a Transaction. If you are running your code in Java SE environment or Java EE application client side code. We create a transacted session by calling the below method on ConnectionFactory class and passing “JMSContext.SESSION_TRANSACTED” as session mode. public JMSContext createContext(int…… Continue reading Sending JMS messages in a Transaction

ExceptionClassifierSkipPolicy example

In this post under Spring Batch, I will explain with an example how to use Spring Batch provided ExceptionClassifierSkipPolicy class. ExceptionClassifierSkipPolicy will not contain the logic of how to handle exceptions when thrown. Instead it is a delegator class which passes the exceptions thrown to appropriate exception handling SkipPolicy classes. ExceptionClassifierSkipPolicy will contain a map…… Continue reading ExceptionClassifierSkipPolicy example