TheCommRequestResponse Class
TheCommRequestResponse class has helper methods for request/response style messaging on top of the core messaging system:
The "...Json" methods let you send requests and responses as TSM messages with JSON payload, using serialized .Net classes as the message contract for both request and response messages:
- Serialized instances are used as the TSM.PLS payload
- The class name is used for the TSM.TXT field, appending a unique correlation id (Guid, in stream form, seperated by a ":" character) to facilitate matching responses to requests.
- The response gets a TSM.TXT with the original message name and a "_RESPONSE" suffix, as well as the ":" separated correlation id or the original message.
PublishRequestJsonAsync<inputT, outputT>: Sends a TSM and waits for a response TSM.
ParseRequestMessageJSON<inputT>: Used by the recipient of the request to obtain the message payload
PublishResponseMessageJson<responseT>
These methods let you send requests and responses using arbitrary TXT, PLS, message names. Response TSMs are assumed to have a _RESPONSE suffix.
PublishRequestAsync
PublishRequestAndParseResponseAsync
PublishResponseMessage
These methods provide the same functionality as the *Async methods, but offer a callback instead of using Tasks:
PublishRequestCallback
PublishRequestJsonCallback
ParseRequestOrResponseMessage: can be used by the recipient of a TSM to parse the message name and correlation id.
Namespace:
nsCDEngine.CommunicationAssembly: C-DEngine (in C-DEngine.dll)