File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Spring and the fly likes spring batch to check unread message Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "spring batch to check unread message " Watch "spring batch to check unread message " New topic

spring batch to check unread message

charu java

Joined: Dec 05, 2012
Posts: 11
Hi Team
I am new to spring and spring batch
I have a requirement to use spring batch to acheive the below things
1.Poll a mail box at regular intervals.
2.Whenever there is a new email in Inbox, irrespective of subject or attachment, place the attachment(if present) in the email into a folder path.
3.Write the details (Time, name of file) into a control table.

I could find many example in javamail api but couldnot find it using springbatch.
Please help me with some sample to acheive it or should i go to spring integration.

Mark Spritzler

Joined: Feb 05, 2001
Posts: 17276

Well to put it in perspective. They are both operate the exact same regardless of environment. Meaning the code to get the mail and do things with the mail is the exact same whether running in a stand-alone application or in a web application or in a Spring Batch batch job.

What I think you need to look and learn is Spring Batch. Their documentation is actually really good. But you will also have to learn Spring first.

In the end Spring Batch code is a POJO in which you can write code to read an email and do your work just like in a POJO.


Perfect World Programming, LLC - iOS Apps
How to Ask Questions the Smart Way FAQ
Saifuddin Merchant
Ranch Hand

Joined: Feb 08, 2009
Posts: 607

Why do you think spring batch is a good fit for this use case? I don't see which feature of spring batch could be useful for the case you describe.

All you need is a simple Java program that "scheduled" using a scheduler cron, quarts which retrieves mail from the mail box..marks it as read etc

Cheers - Sam.
Twisters - The new age Java Quiz || My Blog
I agree. Here's the link:
subject: spring batch to check unread message
It's not a secret anymore!