Could someone help me in this design problem?
We have a standalone batch process (a java class with a main()) which is run every night(a cron-like daemon runs this java class).This batch executes a query on a database ,puts the results(say 10 results) into an XML document(so we have 10 differnt XML docs) and pushes these XML docs as TextMessages into a weblogic JMS que.The MDB listenting to this que takes each XML document passed in the onMessage() and creates new records in another DB by directly calling CMP Entity beans.However,it so happpens that if we have pooled instances of the MDBS, one instance might process message x in the que,and another instance might process message x+1.If both these messages are essentially trying to create the same record ,we are going to get PrimaryKey Exceptions or some other exceptions. I hope i was able to paint a clear picture of our problem.Is it possible to solve this by setting BOTH the initial-beans-in-pool and max-beans-in-free-pool to 1...that way,we will NEVER have more than one instance of the MDB accessing the que.Ny other suggestions are most welcome.Is a MDB even a good way to accomplish what we want?
Thanks in advance,
If both messages contain XML to create the same row (primary key) in the database, then why do you need more than one message for this task? It sounds like you only need one message for creating one record. Did I miss something?
The onMessage of one instance MDB picks the Message from Queue ..
Then there will be no message on the queue for another instance of MDB to
pick. I think you will not face any problem in this go head with u r design.
Thanks for your suggestions,guys! However ,i dont think i explained the problem clearly..leme try again.Also, a new requirement is that we are gonna deploy in a clustered WLS702 env. I understand that if one instance in the pool picks up a message x, then no other instance can pick up x coz its gone from the que. However,what we are facing is that while x is being processes by instance A, instance B might be processing message x+1 SIMULATANEOUSLY...especially if we deploy in a round-robin load-balanced env. And if the task carried out by x+2 depends on data generated by x, its gonna fail....or it it not? on examinging the logs, thats what seemed to be happening. Any more suggestions?
Thanks once again,