• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to send emails to subscribers?

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, I need inputs on how I can design a simple notification system

There is system "Z", which generates certain events( this is an external system), and there are two systems A and B (internal systems )interested in getting email notifications about those events. However, A is interested in type "error" and B is interested in type "failure" of events from Z. I am trying to design system N, which translates those events from Z and send them as an email to A and B. I am not sure how many queues/topics I require.

Please let me know if the below steps are valid/needed/or can be improved

1) System A and B subscribe to emails ( How can they let system N know that they need email notifications ?) If I use a queue or topic. response from N has to be published on that topic. But I want to send out an email
2) System N is listening to queue "test" on which System Z is publishing "error" and "failure" messages.
3) System N read and translates the messages from "test" queue and send email to subscribers i.e  A and B

I am mainly not sure of step 1, how will A and B let System N know that they need email notifications.

Appreciate any suggestions.

Thank you,
 
Rancher
Posts: 326
14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Basically the service maintains a list of subscribers and offers a way to subscribe to it. It's like sign up for a newsletter.
 
Saloon Keeper
Posts: 27762
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to the Ranch, Nishant!

I can think of a couple of approaches. One is to make your notifications be log messages and use email logging channels. Downside is that you have to alter and re-deploy the app if the list changes and the work has to be done by a programmer or administrator.

Another is to code in all that logic into system "Z" and maybe get the routing and user information from a database. SQLite is a good choice if the app doesn't already have a database. Or, alternatively, Apache Derby. Downside is a lot of mail-handling code in the application that has to be written, debugged, and maintained.

The third option I can think of would be to use a mailing list system to do the actual routing. For example, GNU Mailman. Mailman allows you to define multiple mailing lists (topics) and to allow people to subscribe and unsubscribe to them, plus have customized delivery options such s to receive a periodic digest rather than immediate mail.

Mailman is a full dedicated web application, so there's some learning involved, but of course, you may find it useful for other purposes beyond the original Application Z, since it's a general-purpose mailer. Like most good apps these days, it's available as a Docker container, so actual installation and operation is much simpler than if you had to install the old-fashioned way (which is still an option). Mainly you have to define an administrative account and your lists and their eligibility and mailing options. Using this approach, Application Z can simply post to the appropriate list(s) and let Mailtman take care of the downstream routing.
 
Nishant Jha
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you for your reply . I am however looking for approach using JMS. Z is an external system. All it can do it publish messages to queue on System N.
 
Tim Holloway
Saloon Keeper
Posts: 27762
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
JMS and JavaMail are two different protocols. If you want System Z to notify email clients, then you are going to have to have to create a JMS subscriber application that can receive those notifications and create/send email.

Such an app could function as the second of the 3 cases I indicated would do. Or, again, you could have the JMS emailing client app post to Mailman. In either case, the JMS emailing subscriber would be using JavaMail to produce and send the actual emails.
 
Nishant Jha
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you for your quick response .

Can you please explain ->

“you are going to have to have to create a JMS subscriber application that can receive those notifications and create/send email”

In order to send a email, the program should know who to send emails to .

How can System A and system B subscribe to emails ?
I think I understand Flow from Z to N (N is JMS application that can revive those notifications),  however I do not understand how A and B can subscribe to N for emails .?



 
Tim Holloway
Saloon Keeper
Posts: 27762
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
N will have to be an application that acts as a translator from JMS notifications to generate and send emails. For A and B to subscribe to N, N must therefore provide a subscription service. Or, you could simply have N publish to a mail list service (such as Mailman) and let the clients subscribe to it, which would save the trouble of inventing your own subscription service.

A fourth alternative suggests itself along those lines. Hitachi (Pentaho) DI is an open-source (with available commercial support) product whose primary function is data extraction, transformation and loading (ETL). While it's most commonly used to automate pulling data from spreadsheets and loading it to databases, translating data from one database to another, and so forth, I think it has a module that can accept JMS and another one that can send email, so it's quite possible that you could use it to construct a pipeline that does what you want. If you wanted clients to be able to subscribe without administrator assistance that would add some complexity to it, but I think it may be doable. Pentaho DI is really just a Tinker-Toy set for data so you can wire together all sorts of interesting tasks,
 
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't know if it's clear to you yet, so forgive me if this is obvious, but if System N is going to send an e-mail notification to System A then it has to send a message to an e-mail address. It's then the responsibility of System A to read messages which are sent to that e-mail address. You may describe that as publishing and subscribing but the nuts and bolts of the process are as I just described. The two systems have to agree upon an e-mail address which they will use to communicate.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic