Hi
In my ADF application , I have created a managed bean that implements MessageListener
the onMessage method recivies the JMS message from the server and print it correctly.
I need to refresh a RichCommandNavigationItem , the problem is that AdfFacesContext returns null.
I wonder why the AdfFacesContext returns null when trying to access it from the onMessage method.
public class OcsHome implements MessageListener {
private RichCommandNavigationItem notificationLnk;
private TopicSession session;
private TopicSubscriber subscriber;
private TopicPublisher tpub;
TopicConnection tCon;
ActionEvent evnt;
public OcsHome() {
initJms();
}
@Override
public void onMessage(Message message) {
String msgText = null;
if (message instanceof TextMessage) {
try {
msgText = ((TextMessage) message).getText();
String m = message.getStringProperty("MSG");
System.out.println(m);
AdfFacesContext context = AdfFacesContext.getCurrentInstance(); // here is the problem. the context is always null
if (context != null) {
context.addPartialTarget(getNotificationLnk());
}
} catch (JMSException e) {
e.printStackTrace();
}