1

我有两个必须相互处理的应用程序(经典的 java 程序和批处理)。为了尽可能多地解耦它们的通信,我正在考虑在应用程序之间使用队列。

问题是第一个应用程序提供了一些 java 对象,第二个应用程序必须将其转换为另一种对象类型(某种 DTO 模式),并使用新构造的对象执行一些业务逻辑和 Web 服务调用。在这种情况下,使用队列是最好的解决方案吗?

如果是,队列中是否存在性能问题(特别是考虑大小和消耗时间)?实现此队列的最佳方法是什么?

先感谢您 :)

4

1 回答 1

2

Queue is probably the best solution if the job is long running and resource intensive. For example if your batch application is sending out massive emails with the each content the classic application provides, then yes Queue is the right solution.

Drawbacks of queue includes it introduces management overhead like you have to worry about what if the queue gets too large, how to delivery response back to the classic application etc.

If the batch program can process each request from the classic application quickly then I would expose the batch program as web service so the classic application can get immediate response.

于 2012-05-16T09:22:35.300 回答