2 Replies Latest reply on Nov 18, 2014 12:22 PM by Tom Carvin

    Manage source data from another source adapter.

      We want to access to the source data from another source adapter. We tried to use Rhoconnect::Store interface. But


      For example, we have two sources adapter: Operator and Task. First, in the query method of Operator we populate @result with data (this data is stored correctly). After, in the query method of Task, we want to access / add an Operator. We tried this:


          # Test

          mydata = Store.get_data('Operator')

          puts "DATOS: " + mydata.to_s


      We expect to see the data populated in the Operator query, but no results are shown. The class of the adapter is exactly "Operator", maybe it is not the name of the object stored associated to Operator. Our goal is populate Operators in a Task.


      How can we access / add data to one source from other?




        • Re: Manage source data from another source adapter.

          Each source adapter has a number of corresponding sources.

          Source object can be viewed as a set of documents (data) organized by user. I.e. each source adapter has as many sources as there are users (unless the data is partitioned by app, which means that source adapter has only one source and all the data is shared among all users). See here for partitioning and data sets:




          There are several documents for each source stored in Redis. 2 main ones are :md (master document) and :cd (client document - each client will have its own). Each source has at least those 2 docs.

          Based on your question, you want to access the :md. In this case, you can do the following:


          # 1) Load the desired source into memory (by the current user)

          #  here @source instance variable is the current source , i.e. Task

          source_operator = Source.load('Operator',

                      {:user_id => current_user,:app_id => @source.app_id})


          # 2) Now, use source methods to access your data

          my_operator_data = source_operator.get_data(:md)