Gnanam
Gnanam

Reputation: 10923

Can JMS message-queue be used in this context for my use case?

I'm new to message queue system and read a bit about JMS in particular. This question was also helpful in understanding better about real world use case of JMS.

Ours is a web-based application and am trying to find out whether a particular flow in our application context can leverage JMS effectively. Context explained below:

There is an Email Event in the application, that will trigger email to a set of predefined listeners, whenever an event happens in the application. Event could be Consultants submitting timesheet, Consultants submitting expense, etc. Application allows to configure different set of listeners for different events.

My question here is, whether JMS can be used in place for triggering of emails, so that it is loosely/decoupled from the application logic (in this case, submitting timesheet/expense), by not waiting for all emails to be delivered to the listeners. Does it make sense in using JMS in this context? I also want to understand whether my perception/view of the JMS architecture is correct in this regard. Comments/ideas/thoughts/suggestion/advice from experienced users are really appreciated.

NOTE: Our tools of trade are: Java, JDK1.6, JSP, Apache Tomcat v6.0.10, PostgreSQL v8.2.3

Upvotes: 1

Views: 511

Answers (1)

AlexR
AlexR

Reputation: 115388

Definitely. You can create JMS message that will contain appropriate properties. Pre-configured listeners will subscribe to topic and receive messages filtered by selector. Since JMS selector uses SQL like syntax you can create your JMS subscribers dynamically and build the selector according to the application requirements and current configuration.

For example type='timesheet' from='Consultant' will select only timsheets submitted by consultant. Other selector type='expenses' from='Bookkeeper' will get other events (and probably will format email differently.

And this one: type='systemcrash' from='monitor' will send SMS to System Administrator at 3:00AM, Sunday :).

Upvotes: 2

Related Questions