Access pushcontext from EJB-tier
Asked Answered
A

1

1

Im using Primefaces Push (the new thing in 3.4) together with jsf2 and ejb3. Seperate .war and ejb.jar

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:

  1. ManagedBean pass down a callback interface when invoking the ejb method
  2. A JMS messagelistener in the web-tier and ejb to send messages.
  3. Managed bean to analyze returned data from ejb method invocation and do push if conditions are met.

Basicly the question is where to put below code?

PushContext pushContext = PushContextFactory.getDefault().getPushContext();
pushContext.push("/notifications", new FacesMessage(summary, detail));  
Avellaneda answered 6/9, 2012 at 7:23 Comment(1)
Just a note, also try posting your question to atmosphere group.Helve
A
0

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.

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 

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>

Then simply copied two packages from primefaces sources into ejb.jar

org.primefaces.push
org.primefaces.json

because adding primefaces in pom.xml for ejb.jar caused

Missing artifact org.primefaces:primefaces
Avellaneda answered 21/10, 2012 at 14:59 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.