Results 1 to 6 of 6
  1. #1
    Senior Member
    Join Date
    Jul 2009
    Location
    sofia
    Posts
    40

    General data and User specific data

    Hi,
    i successfully integrated ls with gwt in j2ee using jms mom. I have some problems and questions.
    I'm using a modified version of the jms example (jms stocks demo) and the LiteralBasedMetaDataAdapter. In my jboss i defined 2 topics and 2 queues, that are working. I have 2 data adapters that extend the one that uses jms, but when i start the ls server and run 2 clients (one for every adapter) only the first adapter sends data to the client. I tested the adapters separately and they work. I debuged and i saw that for some reason i am entering here:
    Code:
    		if (lastHeartbeatRandom == -1) {
    			dispatchInactiveFlag(itemAttrs);
    		}
    That means that no message is send to the data generator for subscription.

    The other more important:
    I will use ls in two ways:
    I) To supply my webside with general data visible for all users i.e. 10 stock markets.
    II) To supply concrete user with data specific only for him i.e. his money balance or open positions.
    So is it possible to send user specific data i.e. When user logs in in my web site, he must see data specific only for him, for example his open positions. How to secure that no one could access the data stream (specific for user) on ls level? How would the
    adapter know that client A, but not client B has opened his browser.

    Regards.

  2. #2
    Administrator
    Join Date
    Jul 2006
    Location
    Milan
    Posts
    973
    Consider that our sample Adapters may have not been written focusing on multiple instantiation.
    Also consider that the various Adapters are not loaded by the Server through different ClassLoaders, hence the instances are not protected from one another.
    So, we assume that you have checked for possible issues.

    Are you using two independent Data Generators? Do they supply items with different names? Are they also extensions of Lightstreamer Demo Data Generator?
    Please, provide us with some DEBUG level log from both the Adapters and the Simulators.

    About user specific data, you can use user-specific item names.
    Note that the Data Adapter has no knowledge of the users, but the user-specific item names should allow it to find the related data.
    The Metadata Adapter has full control over the item names, hence you can either:
    • force the clients to use user-specific item names and refuse, from getItems, requests that are not consistent with the current user (the whole request would be refused, but this would only occur for hacked requests)
    • use placeholder item names for client requests and decorate the names into user-specific item names in getItems

  3. #3
    Senior Member
    Join Date
    Jul 2009
    Location
    sofia
    Posts
    40
    Hi,
    I am using different adapters for my feeds i.e. i have 2 different feeds (one for stock ticks data (1000 messages per sec), that comes from tcp, and the second is not exactly a feed. When a user do purchase my logic may decide to send purchase data to my admin ui interface that some one monitor all the time. The feeds does not extend the demos. I am only using the jms commons that implement the jms mom, the literalbased metadata adapter and the generator that manages the jms and acts as proxy(feed ->generator->jms->adapter->client).

    I will provide debug logs as soon as possible.

    About the user specific data: Do i have to implement that logic myself or ls provides ready to use implementation? What if i know the item name of client A? Could it be possible to access his data? I this 100% secured?

    Regards.

  4. #4
    Administrator
    Join Date
    Jul 2006
    Location
    Milan
    Posts
    973
    Ok, so you kept the demo JMS part in your generators.
    We have no guess for the reported behaviour, so we'll wait for the debug logs.
    We hope that we can help you by finding some hint from our knowledge of the demo code,
    but consider that the problem, according to the way it was reported, is outside Lightstreamer.

    Turning to the user-specific data, we provide no reusable code, but the idea is quite simple.
    For instance, according to the second of the two options in my previous post,
    getItems should analyze the requested items and,
    if a user-specific item placeholder is found, like "user_portfolio",
    it should return a changed version of the name, like "user_portfolio_for_user1",
    by leveraging the user name supplied to the method,
    or any other information available in the user profile.
    getItems should also check that no item of the form "user_portfolio_for..." is directly requested by the client and throw an exception in that case.

    The technique is safe, because all item requests go through getItems,
    which is implemented by you.

  5. #5
    Senior Member
    Join Date
    Jul 2009
    Location
    sofia
    Posts
    40
    Hi,
    here is the debug code you requested:
    First, my use case scenario is: I open a web page which subscribes to item54.

    In the lightstreamer server:
    31.Aug.09 13:31:05,288 < INFO> Serving request: /lightstreamer/create_session.js?LS_phase=2002&LS_domain=sofiamn& LS_polling=true&LS_polling_millis=0&LS_idle_millis =30000&LS_client_version=4.3&LS_adapter=CLAIRE& from 192.168.2.105:46247
    31.Aug.09 13:31:05,289 < INFO> Starting new session: S69b304075d4a99d8T3105288 from 192.168.2.105:46247
    31.Aug.09 13:31:05,341 < INFO> Serving request: /lightstreamer/control.html?LS_session=S69b304075d4a99d8T3105288& LS_window=1&LS_win_phase=4&LS_op=add&LS_req_phase= 56&LS_mode1=DISTINCT&LS_id1=item54&LS_schema1=mess age&LS_data_adapter1=TICKSJMSADAPTER&LS_snapshot1= true&LS_unique=1 from 192.168.2.105:46247
    31.Aug.09 13:31:05,342 < INFO> Controlling session: S69b304075d4a99d8T3105288 from 192.168.2.105:46247
    31.Aug.09 13:31:05,342 < INFO> Subscribing to item54
    31.Aug.09 13:31:05,342 < INFO> (Subscribing) Valid item: item54
    31.Aug.09 13:31:05,342 < INFO> ------------------>Write LOCK 1
    31.Aug.09 13:31:05,342 < INFO> ------------------>Write UNLOCK 1
    31.Aug.09 13:31:05,342 < INFO> (Subscribing) Inserted in subscribed items list: item54 (17)
    31.Aug.09 13:31:05,342 < INFO> Dispatch thread started
    31.Aug.09 13:31:05,343 < INFO> ------------------>Read LOCK 8
    31.Aug.09 13:31:05,344 < INFO> Message dispatched to JMS: subscribeitem54_17
    31.Aug.09 13:31:05,344 < INFO> ------------------>Read UNLOCK 8
    31.Aug.09 13:31:05,344 < INFO> Dispatch thread ends
    31.Aug.09 13:31:05,352 < INFO> Serving request: /lightstreamer/STREAMING_IN_PROGRESS?LS_session=S69b304075d4a99d8 T3105288&LS_phase=2003&LS_domain=sofiamn& from 192.168.2.105:46247
    31.Aug.09 13:31:05,352 < INFO> Attaching session: S69b304075d4a99d8T3105288 from 192.168.2.105:46247
    31.Aug.09 13:31:05,458 < INFO> Received message
    31.Aug.09 13:31:05,458 < INFO> ------------------>Write LOCK 6
    Notice that jms message for subscription request is send to the queue.

    So, lightstreamer server code receive subscription request for item54 and
    in jboss (i start the modified generator as a thread):
    13:05:30,349 INFO [SLGenerator] Message received: processing...
    13:05:30,350 INFO [SLGenerator] Message:TextMessage received: subscribeitem54_16
    13:05:30,350 INFO [SLGenerator] Recived message: subscribeitem54_16
    13:05:30,350 INFO [SLGenerator] Subscribing item54 (16)
    13:05:30,350 INFO [SLGenerator] (Subscribing) Valid item: item54 (16)
    13:05:30,350 INFO [SLGenerator] Subscribed item54 (16)
    So the item54 is subscribed and the feeder begin to send messages for this item54.

    After that i open another browser tab and open another web page. Here is the log from lightstreamer server:
    31.Aug.09 13:24:17,138 < INFO> Received heartbeat: 823
    31.Aug.09 13:24:17,138 < INFO> ------------------>Write UNLOCK 6
    31.Aug.09 13:24:17,306 < INFO> Serving request: /lightstreamer/create_session.js?LS_phase=6402&LS_domain=sofiamn& LS_polling=true&LS_polling_millis=0&LS_idle_millis =30000&LS_client_version=4.3&LS_adapter=CLAIRE& from 192.168.2.105:35855
    31.Aug.09 13:24:17,307 < INFO> Starting new session: Sd12ee7286cd0e53bT2417306 from 192.168.2.105:35855
    31.Aug.09 13:24:17,424 < INFO> Serving request: /lightstreamer/control.html?LS_session=Sd12ee7286cd0e53bT2417306& LS_window=1&LS_win_phase=4&LS_op=add&LS_req_phase= 75&LS_mode1=DISTINCT&LS_id1=item2&LS_schema1=messa ge&LS_data_adapter1=MANUALBETSJMSADAPTER&LS_snapsh ot1=true&LS_unique=1 from 192.168.2.105:35855
    31.Aug.09 13:24:17,424 < INFO> Controlling session: Sd12ee7286cd0e53bT2417306 from 192.168.2.105:35855
    31.Aug.09 13:24:17,424 < INFO> Subscribing to item2
    31.Aug.09 13:24:17,424 < INFO> (Subscribing) Valid item: item2
    31.Aug.09 13:24:17,425 < INFO> ------------------>Write LOCK 1
    31.Aug.09 13:24:17,425 < WARN> Unexpected snapshot event for DISTINCT item item2
    31.Aug.09 13:24:17,425 < INFO> Inactive flag dispatched: item2 (6)
    31.Aug.09 13:24:17,425 < INFO> ------------------>Write UNLOCK 1
    31.Aug.09 13:24:17,425 < INFO> (Subscribing) Inserted in subscribed items list: item2 (6)
    31.Aug.09 13:24:17,434 < INFO> Serving request: /lightstreamer/STREAMING_IN_PROGRESS?LS_session=Sd12ee7286cd0e53b T2417306&LS_phase=6403&LS_domain=sofiamn& from 192.168.2.105:35855
    31.Aug.09 13:24:17,435 < INFO> Attaching session: Sd12ee7286cd0e53bT2417306 from 192.168.2.105:35855
    31.Aug.09 13:24:17,482 < INFO> ------------------>Write LOCK 7
    31.Aug.09 13:24:17,482 < INFO> ------------------>Write UNLOCK 7
    31.Aug.09 13:24:18,024 < INFO> Received message
    31.Aug.09 13:24:18,025 < INFO> ------------------>Write LOCK 6

    No log in the jboss for the new item2. So i assume that for some reason the adapter does not send subscription request for the item2.

    NOTE1: if i only open the second page in order to subscribe to item2 only it is working but for item54 it is not i.e. it is working only for the first item subscription request.
    NOTE2: The web pages are in different war files deployed on the same jboss server and one apache is used.
    NOTE3: Subscribing for items from one adapter is working.
    PS: The log time is not correct (i added the first log after the second)
    Regards.

  6. #6
    Administrator
    Join Date
    Jul 2006
    Location
    Milan
    Posts
    973
    Indeed, it seems that, for some reason, the MANUALBETSJMSADAPTER Data Adapter does not receive any heartbeat from the remote counterpart.
    The "Received heartbeat: 823" message reported in the log probably refers to the TICKSJMSADAPTER Data Adapter.

    Can you confirm that impression, by analyzing the heartbeat related messages on the full log?
    If this is confirmed, the jboss log should be analyzed;
    you are expected to see 2 generators running there.
    It might be worth differentiating in some way the log lines pertaining to the 2 Data Adapters / generators;
    enabling Log4j to print the current thread name might prove to be enough.

 

 

Similar Threads

  1. Get data specific to each User by passing parameters
    By leonardodar in forum Adapter APIs
    Replies: 3
    Last Post: March 16th, 2011, 09:45 AM
  2. User specific data example
    By zeos in forum Adapter APIs
    Replies: 1
    Last Post: January 28th, 2010, 09:41 AM
  3. User data into XML ?
    By quantri_vn87 in forum Adapter APIs
    Replies: 3
    Last Post: October 29th, 2009, 02:16 PM
  4. User Specific Response
    By vishnugs in forum General
    Replies: 4
    Last Post: April 6th, 2007, 11:06 AM
  5. User-specific push
    By rmusco in forum General
    Replies: 8
    Last Post: February 2nd, 2007, 05:29 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT +1. The time now is 10:58 PM.