Ali
Ali

Reputation: 41

JMX Notifications design

We have a number of related Java Spring applications running on our servers. Lets call them App1, App2 & App3. As is standard all these use the common code in our-common-utils.jar

I want these applications(App1, App2 & App3) to broadcast their state to one or more remote listeners. For e.g. App1: I failed to read file abc. App2: I am using more than 90% of my heap space etc.

The listener/s of these events will take specific actions such as send emails to support and/or clients based on the notifications received.

The best solution I can think of is to have a NotificationSender JMX enabled(implements NotificationBroadcasterSupport) bean in our-common-utils.jar. This will have a thread consuming from a queue of Notifications and firing off sendNotification() to the listeners for each Notification. This will be done by each of the Apps in our eco system but using common code from common-utils.

Do you see any flaws in this design? Any more efficient ways/frameworks of doing it?

Many Thanks :)

Upvotes: 2

Views: 164

Answers (1)

Serhii
Serhii

Reputation: 7543

Alternative solution is to use any distributed coordination service zookeeper for example. I used it in my very first micro service project. As I can see you are using spring. Spring cloud provides necessary solutions that you can use in declarative way. I would pay your attention to @FeignClient. It is very simple in use and flexible in spring world.

If I would work on this issue now, I would use spring hystrix based solution. To simplify integration between your java services I would recommend to check service-registration-and-discovery.


Ignore my opinion if spring is not general engine part in your projects (may be you need other vendor solutions, there are a lot of alternatives). I concentrate my attention on spring solutions because spring is not restricted in my projects and I can use anything I wish if it's reasonable.

Upvotes: 1

Related Questions