8 Replies Latest reply on Apr 18, 2011 1:00 PM by Bill.QE

    Big bug in DataServiceTransaction.CreateItem

    greg li

      createItem  arent pushing anything to the clients in manualsync.

       


      DataServiceTransaction dst = DataServiceTransaction.begin(false);
          String ps[] = {"test_room"};
          dst.setProducerSubtopics("inventory", ps);

      ...

      Product p = new Product(0,"name_"+d.toString(),"description_str","image_path","category_name",99.9, 100);
      service.create(p);

      ...

      dst.createItem( "inventory", p);

      dst.commit();

       

      what's wrong?

      but   dst.addItemToFill("inventory", fill, -1, p);  works well.

        • 1. Re: Big bug in DataServiceTransaction.CreateItem
          Rohit . Kumar Adobe Employee

          Hi,

           

          How are you declaring the Data Service on the client side? Do you have the consumer subscriptions on the DataService set to "test_room" in order to get the updates? Refer to the LCDS 3.1 documentation here for details for how to do it.

           

          Rohit

          • 2. Re: Big bug in DataServiceTransaction.CreateItem
            greg li Level 1

            I am sure the consumer on client was set correct.

            Because removeItemFromFill and deleteItem all worked!

            • 3. Re: Big bug in DataServiceTransaction.CreateItem
              greg li Level 1

              and addItemToFill()

              • 4. Re: Big bug in DataServiceTransaction.CreateItem
                Bill.QE Adobe Employee

                Hi,

                 

                From the manual sync document

                 

                "Note: When you manually route messages, you cannot use the autoRefresh fill capability. Instead, if you want to update fills you must put in calls to manually manage fill membership."

                 

                addItemToFill and removeItemFromFill are methods to manage fill membership, but createItem runs refreshFill to evaluate the new item

                 

                createItem API doc

                     * You use this method to indicate to to the Data Management Service that a new item

                     * has been created. The Data Management Service goes through all sequences currently

                     * being managed by clients and determine whether this item belongs in

                     * each sequence.  Usually it re-evaluates each fill method to make this

                     * determination (though you can control how this is done for each fill

                     * method).  When it finds a sequence that contains this item, it

                     * then sends a create message for this item to each client subscribed

                     * for that sequence.

                 

                createItem requires auto-sync and refreshFill.  It doesn't like the addItemToFill or removeItemToFill.  It is the reason why you cannot find fillParameters in the createItem signature.

                 

                William

                • 5. Re: Big bug in DataServiceTransaction.CreateItem
                  greg li Level 1

                  In fact, in manualsync only the subtopics set by setProducerSubtopics

                  control messages routing,

                  "fill" parameter is useless at all.

                  • 6. Re: Big bug in DataServiceTransaction.CreateItem
                    Bill.QE Adobe Employee

                    Do you mean that dst.addItemToFill(destination, ["abc"], 0, item) makes the item go into both collections where there are 2 fills on client? 

                     

                    ds.fill(collection1, "abc");

                    ds.fill(collection2, "123");

                     

                    William

                    • 7. Re: Big bug in DataServiceTransaction.CreateItem
                      Bill.QE Adobe Employee

                      Thanks for bringing this up. I just tested addItemToSync using different sets of fillParameters.

                      I had fill(collection1, "abc") and fill(collection, "123"); 

                      I called with "abc", I got a message event and the "abc" filled collection updated(not the "123 filled collection").   It was correct. 

                      I called with "123", nothing happened on "abc" filled collection. It was correct.

                      I call dst.addItemToFill(destination, ["ijk"], 0, item);   I thought I was not going to get any message event, but I did.

                      I am going to discuss with the Dev.  I think this should not happen.

                       

                      William

                      • 8. Re: Big bug in DataServiceTransaction.CreateItem
                        Bill.QE Adobe Employee

                        You are right, the setProducerSubtopics control the messages routing no matter that the client has collection which matches the addItemToFill's fillparameters. I thought it was too many messages send to client if the client didn't have the relevant fill.  However, it is how it works.  It is same as the createItem. If you had a message event handler, you could handle the message by the dst.createItem.  For createItem message,  the client's dataservice didn't handle this message since there was no indication how this item related to any of its fills.

                         

                        William