从EJB层访问pushcontext [英] Access pushcontext from EJB-tier
问题描述
我使用原始推送(3.4中的新事物)以及jsf2和ejb3。分隔.war和ejb.jar
Im using Primefaces Push (the new thing in 3.4) together with jsf2 and ejb3. Seperate .war and ejb.jar
现在我需要从ejb层触发一个主推事件。什么是干净的方式来做到这一点?一些选项我可以想到:
Now I need to trigger a prime-push event from the ejb tier. What is a clean way to do this? Some options I can think of:
- ManagedBean在调用ejb方法时传递回调接口
- Web层中的JMS消息收发器,ejb发送消息。
- 托管bean分析从ejb方法调用返回的数据,如果满足条件,则执行推送。
基本问题是下面的代码放在哪里?
Basicly the question is where to put below code?
PushContext pushContext = PushContextFactory.getDefault().getPushContext();
pushContext.push("/notifications", new FacesMessage(summary, detail));
推荐答案
我有工作,我没有去我上面的任何想法,只是添加了从EJB层访问气氛API所需的依赖。
What i've got working, I didnt go with any of my ideas above, just added dependencies needed to access atmosphere APIs from EJB-tier.
ejb.jar的MANIFEST.MF:
MANIFEST.MF for ejb.jar:
Manifest-Version: 1.0
Class-Path:
atmosphere-runtime-1.0.1.jar
atmosphere-compat-jbossweb-1.0.1.jar
atmosphere-compat-tomcat7-1.0.1.jar
atmosphere-compat-tomcat-1.0.1.jar
在pom.xml中为ejb.jar和application.ear
in pom.xml for ejb.jar and application.ear
<dependency>
<groupId>org.atmosphere</groupId>
<artifactId>atmosphere-runtime</artifactId>
<version>1.0.1</version>
<scope>provided</scope>
</dependency>
然后,将两个包从原始源复制到ejb.jar中
Then simply copied two packages from primefaces sources into ejb.jar
org.primefaces.push
org.primefaces.json
因为在pom.xml中为ejb.jar添加了原文引起
because adding primefaces in pom.xml for ejb.jar caused
Missing artifact org.primefaces:primefaces
这篇关于从EJB层访问pushcontext的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!