3 Replies Latest reply on Sep 2, 2004 1:18 PM by Adrian Brock

    message ordering in MDB from queue

    Neil Parkes Newbie

      Hi

      I've got an application design problem:
      I have an (arbitrary) number of clients calling (synchronously) methods on a stateless session bean. I want to release these clients quickly, by using JMS, without seriously compromising the total execute time of all these calls. I have written this so that the clients post an "invoke" message to a queue. This is read by an MDB, and used to invoke the relevant method on the SSB.

      My problem is that although messages are being read from the queue in the correct order (I presume), there is no subsequent control to ensure that the methods on the SSB are executed in the same order. When using only one client I could fix this by using the "Singleton Message Driven Bean" configuration, but this is not suitable when more than one client is writing.

      As far as I can see I have 3 options
      (1) require a 1-1 mapping between clients and mdb-deployments, each mdb jar would contain the same MDB (with the "Singleton" config) reading the same queue but using a different message selector, to which the client could publish: this enforces a dedicated consumer for each publisher.
      (2) put something into the invoker stack for the MDB to order messages by publisher - not sure how you'd do this
      (3) write order numbers into my publisher, and then write wait-notify-wait-etc logic into my MDB - nasty

      anyone got any better ideas?

      Neil