Reliable RPC for DCOM Wrapper


Writing a Client

All methods for reliable RPC are available on the interface object. See Standard Wrapper Properties for details. The methods are

  • RPCService.Reliable (put and get)

  • RPCService.ReliableCommit

  • RPCService.ReliableRollback

  • RPCService.MessageID

  • RPCService.get_StatusOfMessage

Create Broker object and interface object:

// DCOM Wrapper Object
MAILClass    mail;
mail.Logon();

Disable reliable RPC:

mail.Reliable = mail.RELIABLE_OFF;

Enable reliable RPC with AUTO_COMMIT or CLIENT_COMMIT:

mail.Reliable = mail.RELIABLE_AUTO_COMMIT;
mail.Reliable = mail.RELIABLE_CLIENT_COMMIT;

The first RPC message:

mail.SENDMAIL("mail receiver", "Subject 1", "Text 1");

Check the status: get the message ID first and use it to retrieve the status:

String messageID = mail.MessageID;
String messageStatus = mail.get_StatusOfMessage(messageID);
System.out.println("Status: " + messageStatus + ", id: " + messageID);

The second RPC message:

mail.SENDMAIL("mail receiver", "Subject 2", "Text 2");

Commit the two messages:

mail.ReliableCommit();

Check the status again for the same message ID:

messageStatus = mail.get_StatusOfMessage(messageID);
System.out.println("Status: " + messageStatus + ", id: " + messageID);

The third RPC message.

mail.SENDMAIL("mail receiver", "Subject 3", "Text 3");

Check the status: get the new message ID and use it to retrieve the status:

messageID = mail.MessageID();
messageStatus = mail.get_StatusOfMessage(messageID);
System.out.println("Status: " + messageStatus + ", id: " + messageID);

Roll back the third message and check status:

mail.ReliableRollback();
messageStatus = mail.getStatusOfMessage(messageID);
System.out.println("Status: " + messageStatus + ", id: " + messageID);
mail.logoff();

Limitations

  • All program calls that are called in the same transaction (CLIENT_COMMIT) must be in the same IDL library.

  • It is not allowed to switch from CLIENT_COMMIT to AUTO_COMMIT in a transaction.

  • Messages (IDL programs) must have only IN parameters.

Writing a Server

The server implementation consists of the four classes

  • Abstract<IDL library name>Server
  • <IDL library name>
  • <IDL library name>Server
  • <IDL library name>Stub

Add your implementation to the class <IDL library name>Server. There are no server-side methods for reliable RPC. The server does not send back a message to the client. The server can run deferred, thus client and server do not necessarily run at the same time. If the server fails, it throws an exception. This causes a cancel of the transaction (unit of work inside the broker) and the error code is written to the user status field of the unit of work.