2012-09-06 50 views
1

使用Primefaces推送(3.4中的新事物)與jsf2和ejb3一起使用。分開.war和ejb.jar從EJB層訪問pushcontext

現在我需要從ejb層觸發prime-push事件。什麼是乾淨的方式來做到這一點?我能想到的一些選項:調用當EJB方法

  • 了JMS MessageLisener在Web層和EJB發送消息

    1. ManagedBean傳下一個回調接口。
    2. 託管bean分析來自ejb方法調用的返回數據,並在條件滿足時進行推送。

    基本上問題是在哪裏放置代碼?

    PushContext pushContext = PushContextFactory.getDefault().getPushContext(); 
    pushContext.push("/notifications", new FacesMessage(summary, detail)); 
    
  • +0

    只是一個筆記,也嘗試張貼您的問題氣氛組。 –

    回答

    0

    什麼我有工作,我沒有去任何上述我的想法,從EJB層訪問氣氛所需的API剛剛添加的依賴。

    MANIFEST.MF爲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和primefaces來源爲ejb.jar application.ear

    <dependency> 
         <groupId>org.atmosphere</groupId> 
         <artifactId>atmosphere-runtime</artifactId> 
         <version>1.0.1</version> 
         <scope>provided</scope> 
        </dependency> 
    

    然後簡單地複製兩個包

    org.primefaces.push 
    org.primefaces.json 
    

    因爲添加primefaces在pom.xml中爲ejb.jar造成

    Missing artifact org.primefaces:primefaces