-
April 28th, 2014, 02:21 PM
#2
Hi
If I've well understood, what you are asking is how to implement the request reply paradigm with Lightstreamer, stated Lightstreamer is specialized for Publish/Subscribe, rather than Request/Response.
Even if there is not a direct way to implement a request/reply communication, it is possible to use Lightstreamer in a Request/reply fashion through one of the following techniques:
The first technique is to use a subscription request as an actual request for specific data, and use the first published update as the actual reply to the request.
Basically the idea is to use a disposable subscription, where the subscribed item name will represent the request.
The answer will be provided by the first (and only) published update, provided as snapshot.
Once the response is received, the client unsubscribes the given disposable item, since no other update will be published for that item.
If the response depends on the user sending the request and must be different for each user, we can leverage the getItem method of the MetadataProvired.
As example consider the case where an integer number must be summed to the user name, and the user name is a number too.
Most of the error handling is obviously missing to keep the code as small as possible.
We use the LiteralBasedProvider as base class for the MyMetadataAdapter
Client Code:
Metadata Adapter Server code
Data Adapter Server code:
To be continued ...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
All times are GMT +1. The time now is 08:50 AM.
Bookmarks