更新一定的看法编程方式从一个JMS监听器类 [英] Updating certain view programmatically from a JMS listener class

查看:223
本文介绍了更新一定的看法编程方式从一个JMS监听器类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是能够整合的ActiveMQ,并创建一个JMS消费者到我的OpenXava应用程序。现在,我需要更新,在接收到的数据的某些短暂的观点 消息,其中有几个问题需要考虑,通过实例...如何从一个JMS监听器java类去推动改变目前的看法? ... 和 假设具体的看法是目前!!!,但目前看来可能是在整个应用程序中的几个候选条件意见的任何一个! ... 所以?所以?... 然后我没想到,我会坚持的JMS消息到一些实体(如DB一个临时存储),甚至会在一个低性能产生,但再经过 那......我怎么会推最近发生的变化,如果某个用户正在瞬态视图。

I was able to integrate ActiveMQ and create a JMS consumer into my OpenXava application. Now, I need to update certain transient view with the data received in the message, which it have several issues to consider, by example... how to go from a JMS listener java class and push the changes to the current view? ... and supposing the specific view is the current!!!, but the current view could be any one of the several possibles views in the whole application!!! ... so? so?... then I did think, I will persist the JMS messages into some entity (as a temporal storage in DB) even that will incur in a low performance, but then after that... how I will push the recent changes if some user is looking the transient view.

我已经习惯使用一些JSF实现与支持AJAX建立我的web应用,然后我可以接受在JMS监听器的消息,然后得到一个JSF 托管bean参考和使用Ajax推刷新所有可能由一个或多个用户寻找到应用程序中打开的会话,所以这总是产生了 一种实时的应用程序,它更新了所有打开的视图(如果观点是,用户正在观看的)。

I was used to build my webapps using some JSF implementation with ajax enabled, and then I could receive the message in the JMS listener and then get a jsf managed bean reference and use Ajax push to refresh all the sessions that could be opened by one or several users looking into the app, so this always produced a kind of real time application, which update the any opened view (if the view is the one that the user is watching).

那么,有没有一种方法来实现这一目标与JMS监听类到我的OX的应用程序?

So, is there a way to accomplish that with a JMS listener class into my OX app??

在此先感谢,

推荐答案

这是选项可以使用JavaScript来定期调用知道,如果一个新的记录表或任何补充,如果它是区分清爽。

An option can be using JavaScript to calling regularly to know if a new record is added in the table or whatever, and if it is case refreshing.

如果你的Liferay您可以创建与JavaScript的code该页的portlet。这code才可以使用DWR的电话,如果有新的数据就可以打电话了CRUD.refresh直接行动。

If you're liferay you can create a portlet in that page with the JavaScript code. This code can do the call using DWR, and if there is new data it can call to the "CRUD.refresh" action directly.

事情是这样的:

refreshData = function() {
   openxava.executeAction('YourApplication', 'YourModule', '', false, 'CRUD.refresh')
   setTimeout('refreshData()', 5000);
}
setTimeout('refreshData()', 5000);

我没有测试code,所以它肯定不工作,是。把它当作一种想法。

I didn't test this code, so surely it does not work as is. Take it as an idea.

真的,这是一个肮脏的把戏。理想的做法是,OpenXava中将对彗星的直接支持,你可以做到这一点只是打电话到服务器的方法。你认为加入彗星支持OX值得?

Really, this is a dirty trick. The ideal would be that OpenXava would have direct support for comet, you could accomplish this just calling to an method in the server. Do you think that adding comet support to OX worth?

这篇关于更新一定的看法编程方式从一个JMS监听器类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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