-
February 19th, 2010, 03:31 PM
#1
Lightstreaemer Server 3.6 release is now available.
What follows is a sample code for forcing session termination from the Metadata Adapter, made possible by the new "destroy session" request.
The sample can substitute the JMX based one shown earlier in this thread and represents a new implementation of Option 1 introduced above.
So, we show a code snippet that, added to the Metadata Adapter code, listens to the notifications for session initiation and termination and causes each session to be closed after it has lived longer than five minutes.
Upon forced session closure, the Web Client Library will enter "DISCONNECTED" state and won't try to recover the session; it will just notify application code through the "onServerError" event handler, with proper error codes.
Note that the above code can only be used in Lightstreamer "Presto" or "Vivace" edition, in which the text interface is available.
In "Allegro" or "Moderato" edition, we need to resort to the html or javascript interface; the following code snippet exploits the javascript case; the request syntax is the same, but for control.js in place of control.txt.
Note that the response is in javascript and it is more complicated to analyze it.
In case the operation is successful we should expect:
On the other hand, if the session was not found we should expect:
Any other response means that an unexpected condition has occurred.
-
April 19th, 2010, 11:38 AM
#2
Hi Dario,
How to do such thing, for example with the StockList Demo, knowing that this demo is using the default MetaAdapter ?
Do i have to impelement one ?
-
April 19th, 2010, 12:19 PM
#3
Yes, the above code is not part of any available sample, so you should add it and recompile in order to test it.
You can create a subclass of the default LiteralBasedProvider class, for instance.
-
April 20th, 2010, 08:46 AM
#4
Thank you Dario.
What i did is creating a new class, extending the default LiteralBasedProvider class and adding the lines (for destroying the session) in it.
Similar Threads
-
By Alessandro in forum General
Replies: 6
Last Post: February 7th, 2020, 02:03 PM
-
By magnum_rg in forum Client SDKs
Replies: 5
Last Post: August 12th, 2011, 09:43 AM
-
By vaduganathan in forum Client SDKs
Replies: 1
Last Post: May 12th, 2010, 09:26 AM
-
By gjoseph in forum Client SDKs
Replies: 3
Last Post: August 20th, 2009, 10:14 AM
-
By Mone in forum Client SDKs
Replies: 0
Last Post: July 30th, 2009, 09:09 AM
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:02 AM.
Bookmarks