Tuesday, October 07, 2008

JMS Training: Day 2

Day 2 of training started bright and early at 8 AM. Everyone was in the class by 10 till, so we got started. Our instructor is a member of some magic group based in Hollywood, and he starts the morning off with a magic trick.

At 10:30 we are most of the way through what is on the Agenda for us. We have one lecture and one exercise left for the day.

I have created a sender and receiver and run two separate programs to send and receive messages. These messages are very much like RPC calls with COM+ and C#, you know where it's going to, but you don't know what's on the other side answering the message and responding. Unlike COM+ you have to have a separate listener to hear the responses. For what we are considering, we will be using a fire and forget methodology. A web service call with send a message and immediately return success trusting that the message processor will pick up the message and successfully save it to the database. Because there is no way to wait for a response Any business validation that will catch known errors should occur before sending the message to the queue, this is the only way to be able to inform the user that there is an error immediately.

WebPage ---> Ajax Call to Servlet ---> WebService Call --> Business Layer validate()

if successful --> Send Message


--> return success --> Webservice return success --> Ajax refresh the screen.

Then the listener will pick up the message

If the DB is available, write to the DB. Here's where the dangerous part is. Any failure to write to the DB will not be sent back to the user for a retry. It must retry itself or fail completely. We could write this information to an alternate queue, and write our own front end to listen to this error queue and allow modification to the data that is passed in for another attempt. This becomes ugly because we only want the data that was saved by the original user to be saved as it is with no modification. Thus a failure to save must only occur from the database being unavailable, and not from bad data, that is why the validation must be complete and pass before sending to the queue.

We ended today's agenda and started on started on tomorrow's. With only 3 sections left, the instructor expects us to be finished by lunch. I look forward to being out of the classroom. The content is good and the instructor is somewhat entertaining, but the chairs are terrible and my back is killing me. With as much as training classes cost I would expect training facilities to have better chairs than most other places.

No comments: