This week's book giveaway is in the JavaScript forum.
We're giving away four copies of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js and have Paul Jensen on-line!
See this thread for details.
Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Problem in MDB instance !!! Help Needed  RSS feed

 
Meet Gaurav
Ranch Hand
Posts: 492
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI

My MDB is running in OC4J. Say for EX: it has 10 instances. The MDB is picking the Message from Websphere MQ Asynchronously. The problem is � My application is online reservation and the user can reserve the ticket and then immediately cancel that ticket. Reservation is one message and cancellation is another message. While the MDB is Asynchronously picking the message from the MQ. In case if the MDB picks the cancellation message before reservation message, problem will occur� How to handle this situation"

Any Possibility of using message selector in OC4J deployment descriptor

 
Jaikiran Pai
Sheriff
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
user can reserve the ticket and then immediately cancel that ticket


I guess if the user has to cancel the ticket then the ticket related information first needs to be saved (through the first message to the MDB). Only after the ticket is saved, can the user cancel the ticket, isn't it?
 
Meet Gaurav
Ranch Hand
Posts: 492
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HEre we are not handling Synchronous Reply.. Only Asynchronous... So the user Wont get response imeeditely.. How to handle this situation.......???
 
Meet Gaurav
Ranch Hand
Posts: 492
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Any updates on this..
 
Duc Vo
Ranch Hand
Posts: 254
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think it should work automatically. If there is a cancellation before registration, an exception will be thrown. Then the message is returned to the queue. It will go on until the registration message is processed.
Though this is not the ideal way to handle the situation but it should work.

Alternatively, you can just send the cancellation message back to the queue manually if the registration has not been received.

Hope it helps.

Cheers,

Duc
 
Meet Gaurav
Ranch Hand
Posts: 492
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In case of cancellation we will rollback the message and put a sleep in catch block after certain time the cancellation message will be processed. This is fine.

But here another problem is am booking a ticket of 3 members and then changing it to 5 then after some time they were changing it to 4 tickets. Here 3 tickets will be booked after some time 4 tickets message may come and then finally the MDB may receive 5 tickets message. And finally this will become invalid transaction. Client booked 4 at last but the MDB will send the second message 5 tickets at the last.
 
Duc Vo
Ranch Hand
Posts: 254
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In such case, timestamp would help. The message processor should only process a message if the timestamp of the existing record is older than the timestamp fo the comming message. It should work because they are resulted from user's actions which should have distinguishable timestamp.
 
Meet Gaurav
Ranch Hand
Posts: 492
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Duc Vo,

But am planning to run some 50 instances. Is it good to check the timestamp of a message inside onmessage method
 
Duc Vo
Ranch Hand
Posts: 254
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Meet Gaurav:
But am planning to run some 50 instances. Is it good to check the timestamp of a message inside onmessage method[/QB]

I don't see any problem, Meet. Though you will need to do a proper test yourself. Note that if you want to simulate end user clicks, keep in mind that no user is able to send duplicate requests in the same milisecond.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!