3 Replies Latest reply on Feb 6, 2002 9:07 PM by hchirino

    MDB problem

    jdestef

      Hi,

      I have a question about message driven beans. We have an application that has a few moving parts so I will explain what's going on. We are using JBoss 2.4.1 with Tomcat 3.2 running on Windows 2000 server.

      There is a java program which listens on a socket for messages from a non-java messaging engine. When a message is received it is put on a queue. The messages contain patient data. At times sequential messages are for the same patient. This happens often. We have a MDB attached to the queue. When the bean executes it call another session bean to deal with the message.

      That session bean checks a database, MSSQL. If the patient is already in the database the record for the patient is updated. If it's a new patient the record is inserted. To do this the bean first does a query to lookup the patient and then depending on the results runs either an insert or an update against the database. The data access is through a pool. The transaction isolation level on the pool is currently TRANSACTION_READ_UNCOMMITTED. I have also set the level to SERIALIZED with the same results.

      The problem occurs when consecutive messages are for the same patient. What occurs is one bean trying to access the same record that another bean is currently holding onto. One of the beans throws an exception due to a database lock. Eventually the message is retried by the MDB and updates.

      Is there a way to configure the MDB, database pool and perhaps even the database to avoid this. As I said I tried to serialize the database pool but that seemed to have no effect on this issue.

      Any help would be appreciated.

      Thanks

        • 1. Re: MDB problem
          hchirino

          you have to adjust the container config for the MDB so taht only one thread is used to drive the MDB. I think you will find that setting in the standardjboss.xml file under the MDB config. Change the 15 to 1

          Regards,
          Hiram

          • 2. Re: MDB problem
            jdestef

            Thanks,

            That seems to work. Is there a way to specify this configuration for just a specific MDB?

            • 3. Re: MDB problem
              hchirino

              The manual section on advanced container configuration should help. The jboss.xml files specifies which container configuration that each MDB uses. Just create a new container configuration and adjust the jboss.xml to reflect the change.


              Regards,
              Hiram