The ASRequestReplyClient and
ASRequestReplyServer examples work together to demonstrate how two spaces can be used by applications to communicate in a request and reply manner. The two spaces are named
request and
reply.
In this example, ASRequestReplyServer defines the spaces and
ASRequestReplyClient joins the already defined spaces. This is different from most of the other examples where the space is always defined.
Another interesting thing to note about how ASRequestReplyServer is implemented is that it uses the Admin interface to define the 'request' and 'reply' spaces. Most of the other examples define a space using the SpaceDef interface.
ASRequestReplyClient loops, putting messages into the 'request' space. When it is notified of messages in the 'reply' space,
ASRequestReplyClient takes the replies from the 'reply' space.
For every 100 replies received, ASRequestReplyClient prints a message indicating the number of requests that have been sent and the number of replies received.
ASRequestReplyServer periodically polls for messages on the 'request' space. When a message is put into the 'request' space,
ASRequestReplyServer takes it from the space. The name of the ASRequestReplyServer is added to the original message as the responder to the request. This slightly modified message is then put into the 'reply' space. For every 100 requests received,
ASRequestReplyServer prints a message indicating the number of requests it has processed.
The request space has a definition consisting of two fields:
The reply space has a definition consisting of three fields:
ASRequestReplyServer is a seeder for the
request space and a leech for the
reply space.
ASRequestReplyClient is a leech for the
request space and a seeder for the
reply space.
You should start ASRequestReplyServer first. The following examples indicate how to invoke
ASRequestReplyServer for each of the APIs.
You should start ASRequestReplyClient second. The following examples indicate how to invoke
ASRequestReplyClient for each of the APIs.
To invoke ASRequestReplyClient to work in conjunction with the
ASRequestReplyServer example when it has been started with security, use the following command line options:
These command line options start ASRequestReplyServer and
ASRequestReplyClient using the default metaspace name
ms and allow them to connect to a security domain controller that has been starting using the example security policy file
example_policy.txt.