RequestReply » History » Version 3
J. Moringen, 08/03/2011 04:28 AM
updated according to #458
1 | 1 | J. Moringen | h1. Request/Reply Communication |
---|---|---|---|
2 | 1 | J. Moringen | |
3 | 1 | J. Moringen | h2. Introduction |
4 | 1 | J. Moringen | |
5 | 1 | J. Moringen | The Request/Reply communication pattern is provided by pair of classes called @Server@ and @RemoteServer@ or similar: |
6 | 1 | J. Moringen | * @Server@: This class is instantiated in the service-providing RSB process. Provided methods are registered by name and signature. |
7 | 1 | J. Moringen | * @RemoteServer@: This class is instantiated in the service-using RSB process. Each @RemoteServer@ instance has one or more corresponding @Server@ instance, potentially in different processes, that provide the service in question. Client code calls methods on the @RemoteServer@ instance which cause methods of a @Service@ instance to be called and perform the requested task. |
8 | 1 | J. Moringen | |
9 | 1 | J. Moringen | h2. Mapping to Event Concepts |
10 | 1 | J. Moringen | |
11 | 1 | J. Moringen | h3. @Server@ Representation |
12 | 1 | J. Moringen | |
13 | 1 | J. Moringen | Conceptually, the @Server@ instance is the root of the following object graph: |
14 | 1 | J. Moringen | |
15 | 1 | J. Moringen | * @Server@ |
16 | 1 | J. Moringen | ** Scope |
17 | 1 | J. Moringen | ** Method |
18 | 1 | J. Moringen | *** Name |
19 | 1 | J. Moringen | *** Request Listener |
20 | 1 | J. Moringen | Scope: @/SERVER-SCOPE/request/METHOD-NAME/@ |
21 | 1 | J. Moringen | *** Reply Informer |
22 | 1 | J. Moringen | Scope: @/SERVER-SCOPE/reply/METHOD-NAME/@ |
23 | 1 | J. Moringen | ** more methods |
24 | 1 | J. Moringen | |
25 | 1 | J. Moringen | h3. @RemoteServer@ Representation |
26 | 1 | J. Moringen | |
27 | 1 | J. Moringen | Conceptually, the @RemoteServer@ instance is the root of the following object graph: |
28 | 1 | J. Moringen | |
29 | 1 | J. Moringen | * @RemoteServer@ |
30 | 1 | J. Moringen | ** Scope |
31 | 1 | J. Moringen | ** Method |
32 | 1 | J. Moringen | *** Name |
33 | 1 | J. Moringen | *** Request Informer |
34 | 1 | J. Moringen | Scope: @/SERVER-SCOPE/request/METHOD-NAME/@ |
35 | 1 | J. Moringen | *** Reply Listener |
36 | 1 | J. Moringen | Scope: @/SERVER-SCOPE/reply/METHOD-NAME/@ |
37 | 1 | J. Moringen | *** A collection of in-progress method calls |
38 | 1 | J. Moringen | ** more methods |
39 | 1 | J. Moringen | |
40 | 1 | J. Moringen | h3. Communication |
41 | 1 | J. Moringen | |
42 | 1 | J. Moringen | # Client code calls a method on a @RemoteServer@ instance |
43 | 1 | J. Moringen | # The request informer of the method publishes an @Event@ containing |
44 | 2 | J. Moringen | #* The argument of the method call as [[Events|payload]] |
45 | 3 | J. Moringen | #* -A [[Events#Meta Data|user-info]] item with key @ServerRequestId@ and the string representation of a UUID as value- |
46 | 3 | J. Moringen | #* The value @"request"@ in its [[Events|method field]] |
47 | 3 | J. Moringen | # A record containing the -above UUID- event id is created for the method call |
48 | 1 | J. Moringen | # The call blocks until a reply event is received (see below) |
49 | 1 | J. Moringen | # The request listener of the method in a corresponding @Server@ instance receives the @Event@ |
50 | 1 | J. Moringen | # The event is dispatched to a handler for processing |
51 | 1 | J. Moringen | # After processing, the reply informer of the method in the @Server@ sends an @Event@ containing |
52 | 1 | J. Moringen | #* The result of the processing as payload, if the processing succeeded without errors |
53 | 1 | J. Moringen | #* The textual description of the error as payload, if an error occurred |
54 | 1 | J. Moringen | #* A user-info item with key @isException@ and an arbitrary value, if an error occurred |
55 | 3 | J. Moringen | #* -A user-info item with key @ServerRequestId@ and the value received in the user-info item of the same key in the request @Event@- |
56 | 3 | J. Moringen | A user-info item with key @replyTo@ and the id of the request event as value |
57 | 3 | J. Moringen | #* The value @"reply"@ in its [[Events|method field]] |
58 | 1 | J. Moringen | # The reply listener of the method in the @RemoteServer@ receives the reply @Event@ |
59 | 3 | J. Moringen | # The call record is located using the value of the user-info item with key -@ServerRequestId@- @replyTo@ |
60 | 2 | J. Moringen | # The blocking call is notified and |
61 | 2 | J. Moringen | #* returns the payload of the reply event, if a user-item with key @isException@ is not present in the @Event@ |
62 | 2 | J. Moringen | #* signals an error, if a user-item with key @isException@ is present in the @Event@ |
63 | 1 | J. Moringen | |
64 | 1 | J. Moringen | h2. Implementations |
65 | 1 | J. Moringen | |
66 | 1 | J. Moringen | |_.Language |_.File(s) | |
67 | 1 | J. Moringen | | C++ | source:trunk/cpp/core/src/rsb/patterns | |
68 | 1 | J. Moringen | | Java | source:trunk/java/core/src/rsb/patterns | |
69 | 1 | J. Moringen | | Python | source:"trunk/python/core/rsb/patterns/__init__.py" | |
70 | 1 | J. Moringen | | Common Lisp | source:trunk/cl/cl-rsb/src/patterns | |