-
December 19th, 2014, 10:37 AM
#1
RPC - Request/Response - Request/Reply - Conversational Logic with Lightstreamer
---------------------
*UPDATE*
Lightstreamer Server v.7.4.0 introduced official support for request-responde interactions based on the sendMessage facility. Please see this announcement for more information.
---------------------
Lightstreamer originated for asynchronous pub/sub based interaction. But there are cases where using Lightstreamer also for traditional synchronous request/response interaction would be handy. Out-of-the-box support for request/response (aka RPC) will be offered in a future version of Lightstreamer. In the meantime, there are two different ways to easily achieve request/response in Lightstreamer.
Let's see both the solutions through an example.
The request is an integer number and the answer will be the sum of that number with the username (the username is a number too). Most of the error handling is obviously missing to keep the code as small as possible.
SOLUTION 1
A disposable subscription is used. It will carry the request in the item name and the answer in its only update (snapshot). Once the response is received, the subscription will be unsubscribed.
JS Client:
Server (Java Metadata Adapter):
Server (Java Data Adapter):
SOLUTION 2
This is a trick that exploits the capability of the sendMessage call to receive error messages from the Metadata Adapter. This solution can only be used if the notifyUserMessage method in the Metadata Adapter can actually execute fast.
JS Client:
Server (Java Metadata Adapter)
Similar Threads
-
By mello151 in forum Adapter SDKs
Replies: 2
Last Post: June 13th, 2014, 02:22 AM
-
By Swapnonil Mukherjee in forum General
Replies: 1
Last Post: November 4th, 2013, 09:39 AM
-
By aikobit in forum Adapter SDKs
Replies: 9
Last Post: July 8th, 2008, 01:57 AM
-
By vishnugs in forum General
Replies: 4
Last Post: April 6th, 2007, 11:06 AM
-
By sundaramlaxman in forum Client SDKs
Replies: 4
Last Post: February 21st, 2007, 02:11 PM
Tags for this Thread
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 05:59 PM.
Bookmarks