The Consultingwerk.Framework.MessageInteraction package provides utility classes to
allow questions from backend code being raised indirectly on the client.
When client calls into a method (Business Entity or Business Task) on the backend, the backend code
might require to issue a question to the user. This may be particulary frequently the case when migrating
existing business logic from a client-server/fat-client environment.
As the request/response pattern typically implemented with the AppServer does not allow this type of
interaction, the following pattern can be used as a workaround:
When the business logic encounters the need for a question to the user, it returns a Message object
(more specifically a list of Message objects).
Each message provides:
Message Title
Message Text
Message Detail
Possible replies: combinations of yes/no/cancel/ignore/retry
Default reply
Messages are identified by:
a key (e.g. a guid) representing the location in code they are needed
an instance id (useful when the same location in code is occurred multiple times, e.g. in a loop).
Messages do provide after processed by client (user):
actual response
The flow would be:
server code calls into message service (IMessageInteractionService:AskQuestion())
message service provides message object (list of message objects) for client (ListQuestion)
server code stops/undoes current processing and returns message object to client (because AskQuestion returns unanswered)
ListQuestion returned to client and client visualizes questions, e.g. using MessageFormHelper:ProcessQuestions
client provides object and calls into server again - same call as earlier - but providing the message object with a response
server code calls into message service at same location in code/instance, same parameters as above
message service realizes that reply from user is already available
server code continues processing depending on response given by user, because return value from AskQuestion is not unanswered
The interaction is repeated for as long as there are messages encountered in the code.
All replies to earlier questions stay in the message object, so that replies to questions already given
by the user are kept and the system does not need to ask the same question more than once.