Why the AppModuleImpl can not implement MessageListener?

With the help of JDev 12.1.2.0.0.

I tried like crazy market to get some kind of asynchronous updates to work with ADF and it becomes the best of me.  My past attempts have been arguing JMS in the image.

Of a bean to support, I invoke a method AppModuleImpl.  This method adds a ticket # & status in a transient view object and then calls a Message Driven Bean.  This bean gets the message with ticket # and starting to do some work.  During this process, the message bean sends status updates via the 'back' queue, attaching the ticket # in the process.  The AppModuleImpl class implements MessageListener, connects with this queue 'back', and calls its onMessage method.  This, in theory, would allow me to update the view transition with a new status, automatically updated my page jspx object in the process.

It does not work.  On the integration of the program I get this...

Received message back!
<Apr 3, 2014 12:36:00 PM EDT> <Error> <JMSClientExceptions> <BEA-055165> <The following exception has occurred:
 java.lang.NullPointerException.
java.lang.NullPointerException
  at com.stockaid.model.service.AppModuleImpl.onMessage(AppModuleImpl.java:91)
  at weblogic.jms.client.JMSSession.onMessage(JMSSession.java:4855)
  at weblogic.jms.client.JMSSession.execute(JMSSession.java:4529)
  at weblogic.jms.client.JMSSession.executeMessage(JMSSession.java:3976)
  at weblogic.jms.client.JMSSession.access$000(JMSSession.java:120)
  Truncated. see log file for complete stacktrace
> 
Received message back!
... and on and on and on and on .... it loops.

I also tried this approach with a bean of support view extended with particularly strange results (Messaging - JSF Backing Bean boots Variable flow Capacitor and goes back in time... time... time - Stack Overflow).

How the world can implement some sort of asynchronous update with ADF Essentials?  Is it still possible without question?  I do not think that an asynchronous web service would work as reminders trigger only when the operation is complete (correct?).  Ideas?

Here is the AppModuleImpl class for reference

public class AppModuleImpl extends ApplicationModuleImpl implements AppModule, MessageListener {
    /**
     * This is the default constructor (do not remove).
     */


    public final static String JMS_FACTORY = "jms/TestConnectionFactory";
    private static final String RETURN_QUEUE = "jms/TestJMSReturnQueue";
    private static final String QUEUE = "jms/TestJMSQueue";




    private QueueConnectionFactory qconFactory;
    private QueueConnection qcon;
    private QueueSession qsession;
    private QueueReceiver qreceiver;
    private QueueSender qsender;
    private Queue queueReturn;
    private Queue queue;




    private boolean isConnected;




    public AppModuleImpl() {


        isConnected = false;
        try {
            InitialContext ctx = new InitialContext();
            qconFactory = (QueueConnectionFactory) ctx.lookup(JMS_FACTORY);
            qcon = qconFactory.createQueueConnection();
            qsession = qcon.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);


            queueReturn = (Queue) ctx.lookup(RETURN_QUEUE);
            qreceiver = qsession.createReceiver(queueReturn);
            qreceiver.setMessageListener(this);


            queue = (Queue) ctx.lookup(QUEUE);
            qsender = qsession.createSender(queue);


            qcon.start();


            isConnected = true;
        } catch (JMSException e) {
            e.printStackTrace();
        } catch (NamingException e) {
            e.printStackTrace();
        }


    }


    @Override
    public void onMessage(Message msg) {
        System.out.println("Received message back!");
        try {
            Long ticket = msg.getLongProperty("ticket");
            String status = msg.getStringProperty("status");
            Key key = new Key(new Object[] { ticket });
            Row[] rows = this.getAllTickets().findByKey(key, 1);
            if (rows.length > 0) {
                rows[0].setAttribute("status", status);
            }
        } catch (JMSException e) {
            e.printStackTrace();
        }
    }


    public void addTicket(long ticket, String status) {
        ViewObjectImpl allTickets = this.getAllTickets();
        NameValuePairs nvp = new NameValuePairs();
        nvp.setAttribute("TicketId", ticket);
        nvp.setAttribute("status", status);
        Row row = allTickets.createAndInitRow(nvp);
        allTickets.insertRow(row);


        try {
            MapMessage mapMessage = qsession.createMapMessage();
            mapMessage.setLongProperty("ticket", ticket);
            System.out.println("    Sending: " + ticket);
            mapMessage.setStringProperty("value", status);
            qsender.send(mapMessage);
        } catch (JMSException e) {
            e.printStackTrace();
        } catch (Throwable te) {
            te.printStackTrace();
        }
    }


    public void updateStatus(long ticket, String status) {
        Key key = new Key(new Object[] { ticket });
        Row[] rows = this.getAllTickets().findByKey(key, 1);
        if (rows.length > 0) {
            rows[0].setAttribute("status", status);
        }
    }

How I finally reached updates to asynchronous UI with WebSockets and JMS

Tags: Java

Similar Questions

Maybe you are looking for

  • extensions are disabled in firefox's private browsing?

    I recently spent Firefox to chrome, because it gives the unique password manager. But unlike chrome or ie9, it gives no information on extensions,While inprivate browsing. before I use it as my main browser, I want to assure you, that extensions are

  • some play some YouTube videos have I not 2013 macbook pro

    My macbook pro is up-to-date with 0sx el capitan 4gigs I'm unable to watch videos on youtube.  They just say error and not load.  YouTube said its my browser, but its update.  If this were true, then why do some play and some do not.

  • Portege A100 suddenly started going very slowly

    Hello I have a Portege A100, which suddenly began to go very slowly. It takes 5 minutes to load completely upward when it was much faster. I tried to reload Windows on it several times, but as soon as you start loading other pieces of software on the

  • SMS messages send to the non-users of iPhone!

    good so I tried to send a message to my friend who is an Android user. For some reason, none of my SMS messages seem to cross. I can receive their message, but never received mine. The last time I texted him a week ago, they sent very well. The recen

  • What is tpsrv.exe file?

    What is tpsrv.exe file think you.