Java EE组件之间的通知 [英] Notification between Java EE components

查看:174
本文介绍了Java EE组件之间的通知的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到了设计问题。

我的应用程序有多个Java EE组件,简单来说,一个充当服务提供者(非UI),其他人是消费者( UI webapp)。

My application has multiple Java EE components ,In simple terms one acts as a service provider(Non UI) and others are consumers(UI webapp) .

消费者在启动期间从服务提供商处获取配置数据(这基本上是从DB读取数据)并将其存储在Cache中。

The consumer gets the configuration data from the service provider(this basically reads the data from DB) during the start up and stores it in the Cache.

缓存会在定期时间后刷新,以反映在数据库中所做的任何更改。

The cache gets refreshed after periodic time to reflect any changes done at the database.

问题

除了缓存刷新之外,我还想在有人更改数据库时通知消费者,配置已更改,请重新加载。

Apart from the cache refresh, I also want to notify the consumers when someone changes the DB that configuration has been changed please reload it.

我可以使用哪些通知机制来实现这一目标?

What notification mechanisms can I use to achieve this?

推荐答案

我会去使用JMS主题/队列。生产者在主题上发送REFRESH_CACHE消息,所有消费者都在听这个消息

I would go with JMS topics/queues. The producer sending a "REFRESH_CACHE" message on a topic and all consumers listening to this

这篇关于Java EE组件之间的通知的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆