Exploring Eclipse RCP

A "Rich" Alternative for System i GUI Development

March 15, 2007

Adding message queues to the Model (server)

It would be nice if the model (server) programs always do their "normal" or "expected" action for instructions received, but they don't. In the pure System i environment these exceptions are communicated via messages. The model (server) can also use messages and message queues to tell the view-controller (client) about these "abnormal" or "unexpected" events.

Consider a simple case, a model which adds a record to the data base.

A monolithic 5250 program would write the record and trap for an error. If an error occurred it would display information about the and let the user correct it. An error indicator would come on if the record couldn't be added (for example a second instance of a unique key), a decimal data error, NULL data was put into a non-NULL capable field, perhaps an invalid date or time value for a DATE, TIME or TIMESTAMP field.

Suppose a model program is passed the instruction to add a record to a database but encounters any of these problems. There is no interactive user to hand the error back to as in the monolithic 5250 program. How would a service program handle this situation? Message queues! The service program would probably send a message to the caller.

This data queue communicating model (server) design proposed uses message queue to communicate back to the view-controller (client). The Java toolbox does not support program to program messages queues unless the System i program was called by Java. However the Java toolbox does support external message queues.

The model program writes a message with SNDUSRMSG or SNDPGMMSG to the message queue. The Java client reads the message, can even respond to it.

That is the quick version of my model concept for MVC. If you want more information and examples please see the IBM Redbook.

This discussion is not limited to Java PC clients. The clients (view-controller) can be developed with any method, on any platform, which supports data queues and message queues. In this blog the intended clients are Eclipse RCP applications. But the "clients" could be
- 5250 applications running on the same system a different system
- Java desktop clients developed with tools other than Eclipse RCP
- C based desktop clients (Client Access provides DLLs for data queue and message queue)
- some type of web application server which communicates with the business application model though queues
- a peer-to-peer application which needs the services of your model

If your application already separates the business logic into programs you can write a data queue layer to that business logic for the Eclipse RCP client to use.

If your application doesn't already separate the business logic from the display a data queue based model then this is a good general purpose way to get the separation.

Posted by Bill Blalock at March 15, 2007 2:00 PM

Comments

Post a comment




Remember Me?


Bill Blalock
October 2008
Sun Mon Tue Wed Thu Fri Sat
      1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31  

Blog Policy

We welcome your comments and opinions and encourage lively debate on the issues. However, Penton Media reserves the right to delete or move any content that it may determine, in its sole discretion, violates or may violate its Terms of Use or is otherwise unacceptable. For more information, see Penton Media's Terms of Use.

ProVIP Sponsors