-
February 12th, 2009, 02:14 PM
#1
.Net Messaging system - meta and data adapter linking
I am using .Net to develope a messaging system that will be fed data from an SQL database using Lightstreamer. The database table will be checked periodically (interval still to be agreed) for messages that have not already been read. This data will be passed to the data adapter and pushed to the clients accordingly. This will be web-based and users have the option to view just new messages as they are received or can select a different time period. i.e. messages from the last 1, 2, 4 hours etc.
I need to understand how to pass the selected time period via Lighstreamer to retrieve the relevant messages. Also, the messages are only for a particular user and I need to understand how to 'connect' the data adapter and the meta data adapter so the messages are only seen by the expected recipient.
The only .Net demo with code is the stock list but this is pushing the same data to all clients. I need to see how to push different data to different clients. Do you have any .Net sample code for this?
I hope someone has used LIghtstreamer in a simple way and can provide some guidance or sample code.
-
February 13th, 2009, 09:04 AM
#2
In order to return user-specific data, your Data Adapter must supply user-specific items. The Metadata Adapter can enforce that a user-specific item can only be subscribed to by the related user (or that a placeholder item name requested by a user is converted into the user-specific item name).
The Messenger Demo, in
DOCS-SDKs\sdk_adapter_java\examples\Messenger_Adapters
, shows this, though in java.
The items whose name has the form im_<nickname> are user-specific. In this simple case, the Metadata Adapter does not implement user authentication, hence it does not check that a nickname can only be requested by the related user.
About getting historical data based on time (i.e. the last 4 hours), there is no direct support. We expect that those kinds of queries can be issued to the application server that supplies the site pages.
You can still take advantage of Lightstreamer items through some workarounds.
For instance, the snapshot of a DISTINCT mode item can accumulate the history, though it must be limited in size (i.e. it cannot be set as unlimited). If the maximum history dimension expected is limited, then you could use a single DISTINCT item and set a very high snapshot length limit for it, so that all historical events and all new events are kept in the snapshot; then you could manage the requests for different history depths through a selector.
Upon the subscription of the item, the current history should be supplied by the Data Adapter as the item snapshot.
In order not to stress the Server, it is advisable that only few items are of this kind and that such items are always kept subscribed to.
Other workarounds to accomplish your goal are possible.
-
February 13th, 2009, 11:00 AM
#3
Sorry, selectors are not available to .NET Metadata Adapters.
Thus, the suggested technique cannot be used. The use of multiple items to manage different history slices would be needed. However, the best way to handle static queries like yours is to leverage the existing application server.
-
March 22nd, 2009, 02:45 AM
#4
Selectors and .NET
In the current version of Lighstreamer, are selectors supported for .NET? If not:
1. Is there are workaround?
2. Is this feature planed for a future release and if so when is the expected release?
Thanks
-
March 23rd, 2009, 10:31 AM
#5
Selectors are not yet supported through ARI (Adapter Remoting Infrastructure), on which remote .NET Adapter are based. They will be supported in the next major release, which is not expected in the short term.
Consider in any case that selectors should be used only in very specific cases, as they are heavy and are not really necessary. The best approach is to use personal items for each user. Also, Lightstreamer should be used to provide real-time data only, while historical data should come through a normal web/application server.
-
March 23rd, 2009, 02:37 PM
#6
Thanks Alessandro.
As a follow-up, we have a situation where there are multiple sites each wanting data associated with there site. For example all users at Site A should only see Site A data. The Site A data is a subset of a larger group of data which simply means that it is filtered by adapter code. Given that scenario, is it better to have
1. A adapter set for the larger superset of data with adapters for each Site specific data where it can be filtered.
2. A single adapter where each site subscribes to a specific table within the adapter.
It should also be noted that there are multiple data types going to each site e.g.:
Data Type 1: Site A Data Type 1, Site B Data Type 1...
Data Type 2: Site A Data Type 2, Site B Data Type 2...
...
Just trying to understand the best subscription policy that provides the best performance.
Thanks in advance.
-
March 24th, 2009, 09:13 AM
#7
For what concerns the Server, there are no performance differences related with the way different items are supplied.
By resuming, there are 3 ways to do this.
0. Different Adapter Sets for different sites.
1. Different Data Adapters for different sites, belonging to a common Adapter Set.
2. Different items for different sites, all of them supplied by the same Data Adapter.
You could choose based on your convenience. For instance, as you use Remote .NET Data Adapters, using multiple Data Adapters allows you to place different Remote Servers on different hosts.
Just consider that option 1 has a limitation in authorization management.
In fact, the specific Data Adapter to which the items are requested is not notified to the Metadata Adapter. This is because the multiple Data Adapter feature was introduced recently and we preferred not to extensively modify the Metadata Adapter interface. As a consequence, you cannot prevent a client from one site from asking items from a different site, unless you differentiate the item names too (which would make option 1 similar to option 2).
Similar Threads
-
By Alessandro in forum Adapter SDKs
Replies: 4
Last Post: October 24th, 2011, 09:33 AM
-
By churrusco in forum General
Replies: 4
Last Post: November 8th, 2010, 02:26 PM
-
By limeni in forum Adapter SDKs
Replies: 6
Last Post: February 6th, 2009, 08:58 AM
-
By eric.s in forum General
Replies: 3
Last Post: November 24th, 2008, 11:13 AM
-
By rekhender in forum Adapter SDKs
Replies: 5
Last Post: July 23rd, 2008, 09:34 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 04:16 AM.
Bookmarks