RequestReply » History » Version 1
Version 1/9
-
Next ยป -
Current version
J. Moringen, 07/26/2011 04:41 PM
initial version
Request/Reply Communication¶
Introduction¶
The Request/Reply communication pattern is provided by pair of classes calledServer
and RemoteServer
or similar:
Server
: This class is instantiated in the service-providing RSB process. Provided methods are registered by name and signature.RemoteServer
: This class is instantiated in the service-using RSB process. EachRemoteServer
instance has one or more correspondingServer
instance, potentially in different processes, that provide the service in question. Client code calls methods on theRemoteServer
instance which cause methods of aService
instance to be called and perform the requested task.
Mapping to Event Concepts¶
Server
Representation¶
Conceptually, the Server
instance is the root of the following object graph:
Server
- Scope
- Method
- Name
- Request Listener
Scope:/SERVER-SCOPE/request/METHOD-NAME/
- Reply Informer
Scope:/SERVER-SCOPE/reply/METHOD-NAME/
- more methods
RemoteServer
Representation¶
Conceptually, the RemoteServer
instance is the root of the following object graph:
RemoteServer
- Scope
- Method
- Name
- Request Informer
Scope:/SERVER-SCOPE/request/METHOD-NAME/
- Reply Listener
Scope:/SERVER-SCOPE/reply/METHOD-NAME/
- A collection of in-progress method calls
- more methods
Communication¶
- Client code calls a method on a
RemoteServer
instance - The request informer of the method publishes an
Event
containing- The argument of the method call as payload
- A user-info item with key
ServerRequestId
and the string representation of a UUID as value
- A record containing the above UUID is created for the method call
- The call blocks until a reply event is received (see below)
- The request listener of the method in a corresponding
Server
instance receives theEvent
- The event is dispatched to a handler for processing
- After processing, the reply informer of the method in the
Server
sends anEvent
containing- The result of the processing as payload
- A user-info item with key
ServerRequestId
and the value received in the user-info item of the same key in the requestEvent
- The reply listener of the method in the
RemoteServer
receives the replyEvent
- The call record is located using the value of the user-info item with key
ServerRequestId
- The blocking call is notified an returns the payload of the reply event
Implementations¶
Language | File(s) |
---|---|
C++ | source:trunk/cpp/core/src/rsb/patterns |
Java | source:trunk/java/core/src/rsb/patterns |
Python | source:trunk/python/core/rsb/patterns/__init__.py |
Common Lisp | source:trunk/cl/cl-rsb/src/patterns |