Advertisement

05.14.2008 at 11:49PM PDT, ID: 23404142
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

How to use Quartz scheduler to send email when an auction closes

Tags: Java
Hello,

I have a web application that involves users creating auctions. The users can select when the auction should close either 1 Day, 3 Days or 5 Days.

Now when an auction closes, an email is supposed to go out to all users participating in that auction. My question is how can I use Quartz framework for this purpose.

Currently I have a batch job that keeps pinging the database every 10 mins to find which auctions have closed and then sends out the emails.

My specific question is - is it possible to use Quartz framework to setup a timer when an auction is created. What I mean is if the auction is created to close in one day - at the time of creating the auction - start a timer that starts counting down from 24 hours. When the timer reaches zero - we know the auction has expired - and then send out the emails. That way we avoid the unneccessary pings to the database every 10 mins.

Is this possible in Quartz. If so - can someone point me in the right direction, or provide some code snippets or examples that show a similar work being done.

Really appreciate your help.
Thanks
Start your free trial to view this solution
Question Stats
Zone: Programming
Question Asked By: gublooo
Solution Provided By: objects
Participating Experts: 2
Solution Grade: B
Views: 0
Translate:
Loading Advertisement...
05.15.2008 at 12:15AM PDT, ID: 21571209

Rank: Genius

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.15.2008 at 02:21AM PDT, ID: 21571733

Rank: Genius

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.15.2008 at 04:03AM PDT, ID: 21572229

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.15.2008 at 04:12AM PDT, ID: 21572293

Rank: Genius

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.15.2008 at 04:19AM PDT, ID: 21572326

Rank: Genius

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.15.2008 at 04:56AM PDT, ID: 21572493

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.15.2008 at 05:00AM PDT, ID: 21572514

Rank: Genius

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.15.2008 at 05:01AM PDT, ID: 21572521

Rank: Genius

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.15.2008 at 05:10AM PDT, ID: 21572588

Rank: Genius

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.15.2008 at 05:30AM PDT, ID: 21572733

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.15.2008 at 05:33AM PDT, ID: 21572760

Rank: Genius

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.15.2008 at 05:33AM PDT, ID: 21572764

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.15.2008 at 05:35AM PDT, ID: 21572780

Rank: Genius

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.15.2008 at 05:43AM PDT, ID: 21572880

Rank: Genius

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
Loading Advertisement...
Microsoft
  • Internet Protocols
  • Applications
  • Development
  • OS
  • Hardware
  • Windows Security
Apple
  • Operating Systems
  • Hardware
  • Programming
  • Networking
  • Software
Internet
  • Search Engines
  • File Sharing
  • WebTrends / Stats
  • Spy / Ad Blockers
  • Web Browsers
  • New Net Users
  • Web Development
  • Chat / IM
  • Anti Spam
  • Web Servers
  • Anti-Virus
  • Email Clients
Gamers
  • Tips
  • Online / MMORPG
  • Puzzle
  • Emulators
  • Action / Adventure
  • Role Playing
  • Consoles
  • Game Programming
  • Strategy
  • Sports
  • Misc
  • Computer Games
Digital Living
  • Hardware
  • New Net Users
  • New Users
  • Software
  • Digital Music
  • Gaming World
  • Home Security
  • Apple
  • Networking Hardware
Virus & Spyware
  • Vulnerabilities
  • IDS
  • Encryption
  • Anti-Virus
  • Operating Systems Security
  • Software Firewalls
  • WebApplications
  • Cell Phones
  • Operating Systems
  • Internet
  • Hardware Firewalls
Hardware
  • Handhelds / PDAs
  • Displays / Monitors
  • Components
  • Networking Hardware
  • Peripherals
  • Laptops/Notebooks
  • Storage
  • Servers
  • Desktops
  • New Users
  • Misc
  • Apple
Software
  • System Utilities
  • Industry Specific
  • Network Management
  • Photos / Graphics
  • Page Layout
  • VMWare
  • Misc
  • Web Development
  • OS
  • CYGWIN
  • Voice Recognition
  • Message Queue
  • Quality Assurance
  • Security
  • Firewalls
  • MultiMedia Applications
  • Development
  • Database
  • Office / Productivity
  • Business Management
  • OS/2 Apps
  • Server Software
  • Internet / Email
ITPro
  • OS
  • Storage
  • Encryption
  • Operating Systems Security
  • Apple Hardware
  • Laptops & Notebooks
  • Servers
  • Networking Hardware
  • Peripherals
  • Devices
  • Displays / Monitors
  • WebTrends / Stats
  • Search Engines
  • Firewalls
  • WebApplications
  • IDS
  • Vulnerabilities
  • Email Clients
  • File Sharing
  • Spy / Ad Blockers
  • Web Browsers
  • Web Servers
  • Networking
  • Anti-Virus
  • Chat / IM
  • Anti Spam
Developer
  • Web Servers
  • Web Browsers
  • Game Programming
  • Dev Tools
  • Industry Specific
  • Office / Productivity
  • Database
  • CYGWIN
  • Web Development
  • Search Engines
  • File Sharing
  • WebTrends / Stats
  • Programming
  • Content Management
  • Application Servers
  • Protocols
Storage
  • Removable Backup Media
  • Storage Technology
  • Servers
  • Grid
  • Remote Access
  • Backup / Restore
  • Misc
  • Hard Drives
OS
  • Miscellaneous
  • Security
  • Development
  • Linux
  • VMWare
  • MainFrame OS
  • Unix
  • Apple
  • OS / 2
  • AS / 400
  • BeOS
  • Microsoft
  • VMS / OpenVMS
Database
  • Oracle
  • Miscellaneous
  • MySQL
  • Software
  • Sybase
  • Contact Management
  • PostgreSQL
  • Data Manipulation
  • Clarion
  • InterSystems Cache
  • Siebel
  • MUMPS
  • OLAP
  • SQLBase
  • SAS
  • GIS & GPS
  • 4GL
  • Berkeley DB
  • DB2
  • Informix
  • Interbase / Firebird
  • FoxPro
  • Reporting
  • LDAP
  • Filemaker Pro
  • MS SQL Server
  • dBase
  • MS Access
Security
  • Misc
  • Web Browsers
  • Software Firewalls
  • Operating Systems Security
  • File Sharing
  • Spy / Ad Blockers
  • Vulnerabilities
  • WebApplications
  • IDS
  • Anti-Virus
  • Encryption
  • Anti Spam
  • Email Clients
  • VPN
  • Chat / IM
Programming
  • Editors IDEs
  • Installation
  • Handhelds / PDAs
  • Multimedia Programming
  • System / Kernel
  • Algorithms
  • Game
  • Signal Processing
  • Project Management
  • Open Source
  • Database
  • Misc
  • Languages
  • Processor Platforms
  • Theory
Web Development
  • Scripting
  • Blogs
  • Web Servers
  • Software
  • Search Engines
  • Web Graphics
  • Images
  • Internet Marketing
  • Images and Photos
  • Components
  • Document Imaging
  • Web Languages/Standards
  • Illustration
  • WebApplications
  • Fonts
  • WebTrends / Stats
  • Authoring
  • Digital Camera Software
  • Miscellaneous
Networking
  • Protocols
  • Apple Networking
  • Network Management
  • Message Queue
  • Application Servers
  • Content Management
  • File Servers
  • Email Servers
  • Misc
  • Java Editors & IDEs
  • Wireless
  • Networking Hardware
  • Backup / Restore
  • System Utilities
  • ISPs & Hosting
  • Web Servers
  • Storage Technology
  • Removable Backup Media
  • Servers
  • Broadband
  • Grid
  • OS / 2
  • Novell Netware
  • Unix Networking
  • Windows Networking
  • Security
  • Telecommunications
  • Operating Systems
  • Linux Networking
Other
  • Community Advisor
  • Lounge
  • Community Support
  • New Net Users
  • Philosophy / Religion
  • Math / Science
  • Miscellaneous
  • URLs
  • Expert Lounge
  • Politics
  • Puzzles / Riddles
Community Support
  • Suggestions
  • New to EE
  • New Topics
  • Community Advisor
  • CleanUp
  • Announcements
  • General
  • Feedback
  • Input
  • EE Bugs
 
05.15.2008 at 12:15AM PDT, ID: 21571209

Rank: Genius

yes you can do that, have a read thru here

http://www-128.ibm.com/developerworks/java/library/j-quartz/

Don't forget to create your schedules both when a new auction is created, and also when app starts.

 
05.15.2008 at 02:21AM PDT, ID: 21571733

Rank: Genius

Such a solution won't scale well. The most efficient way would probably be to set up a trigger in the database
 
05.15.2008 at 04:03AM PDT, ID: 21572229
Why do you say it wont scale well and how do I set a trigger in the database. I thought database triggers cannot be used here.
 
05.15.2008 at 04:12AM PDT, ID: 21572293

Rank: Genius

>>Why do you say it wont scale well

Because the more auctions you have, the more running timers you'll have

>>I thought database triggers cannot be used here.

That would depend on the db you have. What is it?
 
05.15.2008 at 04:19AM PDT, ID: 21572326

Rank: Genius

> Why do you say it wont scale well and how do I set a trigger in the database. I thought database triggers cannot be used here.

It'll scale just fine. Quartz can handle a very large number of schedules
We've never had a problem with it.

 
05.15.2008 at 04:56AM PDT, ID: 21572493
I'm using Mysql database.

That thought did occur my mind about the number of timers - Good to know from Objects that Quartz can handle a large number.

This is the other approach I had in mind:
 1) Schedule a job in Quartz to run once every hour. This job will look for auctions expiring in that hour. Say for example, its looking for auctions that expire between 10:00 AM and 11:00 AM. And we have three groups expiring - one at 10:10AM, second at 10:27AM and the third at 10:45 AM.
2) Now for these 3 groups - we will schedule 3 seperate one time jobs to execute at 10:10,10:27 and 10:45 to send out emails for the respective groups

What do you guys think of this approach?
 
05.15.2008 at 05:00AM PDT, ID: 21572514

Rank: Genius

I wouldn't overcomplicate unless you find a need to. Keep it simple initially :)
Quartz's job is to handle the sceduling, so don't bother yourslf unecessarily with scheduling that quartz is designed for.

 
05.15.2008 at 05:01AM PDT, ID: 21572521

Rank: Genius

The number of timers Quartz can handle is not really the point. It's simply not a particularly efficient way of doing things if another way, such as triggers, can be found
 
05.15.2008 at 05:10AM PDT, ID: 21572588

Rank: Genius

Sadly, in this case, it's academic - MySQL doesn't support external calls from triggers
 
05.15.2008 at 05:30AM PDT, ID: 21572733
Objects - I'm just thinking that if an auction is going to close in 7 days - then we kick off the scheduler - but during these 7 days time - if for some reason the server crashes and needs to be restarted - we have to persist the job information.

But in the approach I suggested - we wont have to worry about that - we can build the logic that the job that runs every hour - can also check which auctions that expired earlier but had not sent the emails bcos of server crash or something and send them out as well.........

CEHJ - Are you suggesting that I can create triggers in Mysql - to see which auctions have expired. I've never come across creating triggers for this purpose. Can you explain how this can accomplished via triggers

thanks
 
05.15.2008 at 05:33AM PDT, ID: 21572760

Rank: Genius

>>
What I mean is if the auction is created to close in one day - at the time of creating the auction - start a timer that starts counting down from 24 hours. When the timer reaches zero - we know the auction has expired - and then send out the emails.
>>

>>
1) Schedule a job in Quartz to run once every hour. This job will look for auctions expiring in that hour. Say for example, its looking for auctions that expire between 10:00 A .....
>>

The most efficient way if you're going to use the scheduler is to schedule one-time jobs in each case. When the task is due for execution, make it check in the db that the auction has not been cancelled in some way just prior to sending the mail. You can integrate the sending of the mail with your logging by using an SMTPAppender
 
05.15.2008 at 05:33AM PDT, ID: 21572764
ok atleast one option is closed for me now :)
 
05.15.2008 at 05:35AM PDT, ID: 21572780

Rank: Genius

> f for some reason the server crashes and needs to be restarted - we have to persist the job information.

as i mentioned earlier, you just initialze your schedule on startup.
Plus quartz supports persistence,

And steer clear of db triggers, they'll just cause u a world of hurt down the track.

Accepted Solution
 
05.15.2008 at 05:43AM PDT, ID: 21572880

Rank: Genius

>>You can integrate the sending of the mail with your logging by using an SMTPAppender

(Unless you have quite a range of mails to send - in which case a JavaMail solution would be better)
Assisted Solution
 
 
20080236-EE-VQP-29 / EE_QW_2_20070628