i am learning JMS, i want to apply it with JSF, i created 2 managed beans the producer which sends the message and the consumer, i made a MDB which implements the messagelistner and has onMessage method, the JMS provider is Wildfly 8, i can send the message from JSF by the producer and the MDB receive it, i want to make the MDB access the consumer managed bean and set the message then update it in the JSF again, i tried @Managedproberty and @EJB but i get null, also the requestContext and faceContext is null in the MDB, i am still beginner at EJB so i miss many things, my question how can i access the managed bean from EJB generally and MDB specially, i know i can use other technologies to do that like prime push or even web sockets but i want to learn the JSM first. this is the MDB code
package boddooo.jms;
import java.io.Serializable;
import javax.ejb.ActivationConfigProperty;
import javax.ejb.MessageDriven;
import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.MessageListener;
import javax.jms.TextMessage;
import org.primefaces.context.RequestContext;
@MessageDriven(
activationConfig = { @ActivationConfigProperty(
propertyName = "destination", propertyValue = "jms/queue/boddooo"), @ActivationConfigProperty(
propertyName = "destinationType", propertyValue = "javax.jms.Queue")
},
mappedName = "jms/queue/boddooo")
public class mdb implements Serializable, MessageListener {
private static final long serialVersionUID = 1L;
TextMessage tm;
@Override
public void onMessage(Message message) {
if(RequestContext.getCurrentInstance()!=null){
RequestContext fc=RequestContext.getCurrentInstance();
consumer c=(consumer)fc.getAttributes().get("consumer");
tm = (TextMessage) message;
try {
c.setMsg(tm.getText());
} catch (JMSException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
}