1 2 Previous Next 24 Replies Latest reply on Oct 29, 2007 3:15 PM by jkurtz_wa Go to original post
      • 15. Re: Extensions to EJB3:  Message Driven POJOs
        redijedi

         

        Also, the transactionManagement property in @Consumer (as described in the wiki) seems to have disappeared.


        I was beginning to wonder that exactly. All of my tests have shown that transactions are not maintained regardless of the connectionFactory used.

        Removal of transactions is a show stopper for my group. It would be nice to have this. Even if it presupposes synchronous behavior, I feel as though this is okay because it allows us to provide a decoupled application at least. In this way we can allow concerns to be clearly defined. We strive to ensure that there is no concern leakage. However, if there is no transaction support, we'll have to bleed some of the concerns into other parts of the application. This is unfortunate.

        I still see JBoss' mdps as a great step forward, just not 100% what we had hoped for.

        • 16. Re: Extensions to EJB3:  Message Driven POJOs

           

          "bill.burke@jboss.com" wrote:
          The whole idea is to remove all the lookups and bootstrap code you have to do to obtain and send a message and receive and dispatch a JMS message. With regular JMS you have to

          1) Get a connectionfactory
          2) Get a connection
          3) Get the destination
          4) ... and so on.

          The idea with MDP's are

          1) Get a producer
          2) Invoke on producer

          ...



          I think MD-POJO's are an excellent idea. I have one feature request though.

          Is it possible to enhance the ProducerManagerImpl's open and close operation such that they can be reused. Currently

          If I do
          pm.open()
          //do some work
          pm.close()

          I can't reuse the pm at a later execution, because pm.close() closes the connection objection but does not remove PM's reference to the connection, while pm.open() does not try to create a new connection (or reopen an existing connection that is closed) if PM has a reference to a connection object (regardless of the connection object's state).


          • 17. Re: Extensions to EJB3:  Message Driven POJOs
            frjasobe

            Hi,

            I have use @MessageDriven with no problem but when I have tried to use @Producer and @Consumer, I think I can't refactorize method start in that code(we filtrate message and add a listener):

            ...


            @MessageDriven(mappedName = "queue/CentralitaInQueue", activationConfig = {
            @ActivationConfigProperty(propertyName = "destination", propertyValue = "queue/CentralitaInQueue"),
            @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue")
            }
            )
            public class ConectorJBoss extends Conector implements MessageListener {

            ...
            public void onMessage(Message message) {

            ObjectMessage objMessage = (ObjectMessage) message;

            try {

            ApduCentralita apdu = (ApduCentralita) objMessage.getObject();
            super.enviarComando(apdu);

            } catch (JMSException e) {

            Log.getLogger(this).error(e);

            }

            }

            ...
            public void start() {

            try {

            //se crea el jmsworker
            //jmsworker = new JMSWorker(null, JMSWorker.TIPO_LOCAL);
            jmsworker = new JMSWorker(Constantes.CONNECTION_FACTORY_CENTRALITAS);
            //jmsworker = new JMSWorker(this.queueConnectionFactory, this.topicConnectionFactory);

            //selector jms para que solo tome los comandos que le corresponden
            String selector = SELECTOR_JMS_CENTRALITA.replaceAll("\\#host_centralita", inetSockAddr.getAddress().getHostAddress());
            selector = selector.replaceAll("\\#puerto_centralita", new Integer(inetSockAddr.getPort()).toString());

            //anyadirse a si mismo como listener de la queue de comandos
            jmsworker.receiverQueue(Constantes.QUEUE_CENTRALITAS_COMANDOS, this, selector);
            //jmsworker.receiverQueue(this.queue, this, selector);

            //se inicializa y cachea el publisher que se utilizara para enviar eventos a la cola de eventos
            jmsworker.openCachedPublisher(Constantes.TOPIC_CENTRALITAS_EVENTOS);
            //jmsworker.openCachedPublisher(this.topic);

            } catch (Exception e) {

            Log.getLogger(this).error(e);
            }

            }

            ...

            }


            Can I do this with JBoss Extension for MDB ?

            Thanks.

            • 18. Re: Extensions to EJB3:  Message Driven POJOs
              yel

              hi i tired the consumer example and ends with a mysterious error



              14:22:14,470 ERROR [STDERR] javax.naming.NameNotFoundException: ma.anfatech.tut.services.QueueTestRemote not bound
              


              this caused by this line:

              QueueTestRemote tester = (QueueTestRemote)ctx.lookup(QueueTestRemote.class.getName());
              

              does this happen because i changed the packge name of the class ??
              any suggestion will be apreciated
              Greetings
              Yassine

              • 19. Re: Extensions to EJB3:  Message Driven POJOs
                maximuszen

                testsuite link is broken

                • 20. Re: Extensions to EJB3:  Message Driven POJOs
                  maximuszen

                  my bad

                  • 21. Re: Extensions to EJB3:  Message Driven POJOs
                    dmitrynegoda

                    Hi!

                    We need some way to configure a message before it gets sent. The reasons are:
                    1. we need to use message headers, so that selectors could be used;
                    2. we don't always hardcode a message ttl

                    Well, mapping a message argument to a message header&ttl would be awesome, but simple pm.setMessageHeader(...) and pm.setMessageTtl() will also work for us.

                    Thanks.

                    • 22. Re: Extensions to EJB3:  Message Driven POJOs
                      jkurtz_wa

                      A broken link exists to the testsuite on this page

                      http://www.jboss.org/wiki/Wiki.jsp?page=MessageDrivenPOJOs


                      Am trying to use a stateless bean to return the contents of a MDB, but am having problems with the callback. The @Consumer and Producer Manager look promising. I need something like the Entity Manager that gets an instance to the Entity bean, but this would be a Message Manager to get the instance of the Message Bean.

                      • 23. Re: Extensions to EJB3:  Message Driven POJOs
                        alrubinger

                        Thanks for pointing out the broken link in the Wiki, I've updated it:

                        http://anonsvn.jboss.org/repos/jbossas/trunk/ejb3/src/test/org/jboss/ejb3/test/consumer/unit/ConsumerUnitTestCase.java

                        Not sure what you mean by "return the contents of an MDB", or your intent...elaborate?

                        S,
                        ALR

                        • 24. Re: Extensions to EJB3:  Message Driven POJOs
                          jkurtz_wa

                          Thanks for fixing that link..

                          I have a remote client that needs to read a message from an MDB using a stateless session bean. Whereas I can easily write to the Bean and see the on-message method firing, I can not seem to be able to return that message to another remote client.

                          I can do this using an existing queue in JBoss. With an MDB, I need to be able to get an instance of the MDB or produce some type of callback, to let the stateless bean first know there is a message, then read the contents of the MDB.

                          With an entity bean, one uses the Entity Manger to get an instance of the object, so there maybe a similar way to get the "handle" of the MDB.

                          I am going to check out using the @Consumer tags to see if that will work. If you have any design suggestions and pointers to some tutorials, that would really help

                          1 2 Previous Next