Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

WebApp Design Issue  RSS feed

 
Peter Loew
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

We currently have a J2EE Web App that is responsible for handling clearance requests. This same app also emails out the clearance results via a separate thread that is initialised from the servlet.

The problem is sometimes the thread gets stuck and we need to restart the entire app.

What is the best design approach to reworking the email functionality of the web app? Should a J2EE app that has a primary business function (to clear requests) also be responsible for emailing them out too? What are the design choices and which would be best practice?

Thanks so much,

Peter
 
Chetan Parekh
Ranch Hand
Posts: 3640
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We have an application that required to send mails to the customers.

First we store email details in database.

We have separate Java Application that queries database on the regular basis and sent the email.

If our emailing application got problem, we have entry in the database so we can resend emails and we don�t have to restart the main application.
 
Kai Witte
Ranch Hand
Posts: 356
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello,

I recommend to use an asynchronous messaging queue. Configure a message-driven bean as the receiver.

That would solve the problems with your current solution.

Compared to Chetan's way it has some
Advantages:
  • more scalable
  • uses existing software so that you don't have to implement all features, for example message queue processing
  • can easily be integrated into the deployment process for the entire application

  • Disadvantages:
  • The technologies involved are complex, so that writing it all on your own might be less error-prone after all, especially when you are not very well familiar with them.
  • Problems are hard to track and are lurking everywhere.


  • Kai
     
    Peter Loew
    Greenhorn
    Posts: 27
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Thanks for the response.

    A message-driven bean would be overkill and add unnecessary complexity since the app does not have an EJB layer.

    Thanks for the suggestions though.
     
    Bear Bibeault
    Author and ninkuma
    Marshal
    Posts: 66188
    151
    IntelliJ IDE Java jQuery Mac Mac OS X
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    I've usually handled this in a manner similar to Chetan -- having a daemon process handle the bulk emaling.
     
    Don't get me started about those stupid light bulbs.
    • Post Reply Bookmark Topic Watch Topic
    • New Topic
    Boost this thread!