开发者

Notification Mechanism Using Spring

开发者 https://www.devze.com 2023-03-19 21:21 出处:网络
I have currently two wars files in which one war has to send notification to other war file using spring.Both of the wars are implemented using spring and web service.

I have currently two wars files in which one war has to send notification to other war file using spring.Both of the wars are implemented using spring and web service. My requirement is first war has to 开发者_开发知识库send notifications to other war file. Could you please provide some pointers to implement the same using spring ?


I do not know exactly your requirements but I'd suggest you to use RestFull web service for this notification. Spring has a perfect support of this kind of services.

Internally the first application will send HTTP POST (or GET) request like http://thehost/webapp2/mynotification

Other way is to communicate using JMS. This way is good if you have to make the communication asynchronous. Spring supports JMS using JMS templates.


You can use:

  • JMS
  • a webservice (or spring http invoker) in the target app and invoke it from the notifier


You can use RMI to export your beans and make them visible from other modules, better than other alternatives in this case because:

  • JMS is asynchronous and needs a middleware.
  • Webservice are less efficient (since it is mostly conceived to communicate heterogeneous platforms).

Take a look here on how to do it:

http://static.springsource.org/spring/docs/3.0.x/spring-framework-reference/html/remoting.html#remoting-rmi

But I would first of all review the architecture you are using, in case you can refactor it for a better integration of business logic.

0

精彩评论

暂无评论...
验证码 换一张
取 消