Answered StreamInsight Problems with UDO..

  • Tuesday, December 11, 2012 3:17 PM
     
     

    I have a question for all you smart folk out there re StreamInsight!  I am trying to create a query; one which allows new events to be dynamically created depending on a given threshold value (e.g filter field etc).  I have a purchase order (PO) query, which can only generate new PO's if an account balance (threshold) is above a certain amount.  The difficulty I am having is that once a new PO is generated then the value of that order needs to contribute to the limit query aka threshold.

    So .. some questions

    1) I am using an UDO to load the initial balance into a static singleton manager, this is then shared between both input and output streams.  Thus, any new purchases contribute changes the amount held in the singelton.  Is there a better way to share reference data between input and output streams/queries without the use of UDO's?

    2) I started off trying to solve this problem using a pass through input output adapter; one which sent the current adjusted balance to an output adapter and in turn fed it back into the input query - this never actually worked since the input query binding cannot be changed - so the question is is there a better way to share state of a single adapter accross several SI queries?

    Thanks

    Craig.

All Replies

  • Wednesday, December 12, 2012 12:58 AM
     
     Answered

    On question 1 ... have you looked at the pattern for slowly changing reference data? This exact method probably won't work for you but you could certainly do something similar. The keys are a) event duration/lifetime and b) importing CTIs from the data stream. And which version of StreamInsight are you using?

    On question 2 ... I'm not sure that I understand what you are trying to solve and, besides, it depends on which version of StreamInsight you are using. In StreamInsight 2.1, you can use subjects while < 2.1, you'll need to look at DQC. Subjects provide a WHOLE lot more flexibility than you'll have with DQC.


    DevBiker (aka J Sawyer)
    Microsoft MVP - Sql Server (StreamInsight)


    Ruminations of J.net


    If I answered your question, please mark as answer.
    If my post was helpful, please mark as helpful.

    • Marked As Answer by 2deviate Monday, December 17, 2012 10:30 AM
    •  
  • Wednesday, December 12, 2012 8:16 AM
     
     

    hi devbiker - tx for your reply.  In short I have recently upgraded to 2.1 and have not yet experimented with Subjects/ DQC. I assume they are part of the standard server standalone deployment model?

    The problem I am trying to solve in Q2 is for a slow changing reference stream to be updated based on events further down the line.  In my case I load an intial account "balance" and as orders are processed, the running total diminishes.  This halts further orders if the balance value drops below a certain threshold. 

    Regards

    Craig

  • Wednesday, December 12, 2012 2:10 PM
     
     
    Since you are on 2.1, you can use subjects, which is different from DQC (dynamic query composition). With subjects, you can do everything that DQC does ... and then a whole lot more. I worked out a sample last nite ... I'll be posting on my blog in a little bit and I'll update here. :-)

    DevBiker (aka J Sawyer)
    Microsoft MVP - Sql Server (StreamInsight)


    Ruminations of J.net


    If I answered your question, please mark as answer.
    If my post was helpful, please mark as helpful.

  • Wednesday, December 12, 2012 4:06 PM
     
     
    OK ... blog post is up at http://www.devbiker.net/post/Using-Subjects-as-a-e2809cFeedback-Loope2809d.aspx. You'll want to tweak things a bit for your use case but that should give you a good idea of where to start.

    DevBiker (aka J Sawyer)
    Microsoft MVP - Sql Server (StreamInsight)


    Ruminations of J.net


    If I answered your question, please mark as answer.
    If my post was helpful, please mark as helpful.