question

ojhatushar avatar image
ojhatushar asked Jacob Abrams commented

How to load multiple inventory items quickly clover sdk ?

I have approx 7000 inventory items. I am fetching and storing in a database and after that setting in spinner, because various operations is doing after that based on that. So any way is there by which we can load inventory items quickly.Because it takes time when fetching inventory items and storing in database.Please help...

Inventory
1 comment
10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Jacob Abrams avatar image Jacob Abrams ♦♦ commented ·

Please share the code you are using to load and save inventory. It's unclear where your code runs (device or server?). Saving inventory into your own DB shouldn't be necessary since you can read it dynamically any time and the merchant may change it at any time so your copy could easily be out of date.

0 Likes 0 ·
David Marginian avatar image
David Marginian Deactivated answered Jeffrey Blattman commented

If you are loading the inventory into your own database the initial query/insert will take some time but after that you can use webhooks (https://docs.clover.com/clover-platform/docs/webhooks) and only query for the details of items that have been modified.

6 comments
10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

ojhatushar avatar image ojhatushar commented ·

I am using local database like realm. webhooks is useful at that time.

0 Likes 0 ·
ojhatushar avatar image ojhatushar commented ·

I think webhook is use only when api is there. I am storing data in local database like realm

0 Likes 0 ·
David Marginian avatar image David Marginian ♦♦ ojhatushar commented ·

Your question is very vague. If you are just talking about loading items from a local database, I don't see what this question has to do with Clover.

0 Likes 0 ·
ojhatushar avatar image ojhatushar David Marginian ♦♦ commented ·

I am using inventory connector and storing inventory items in local database and setting in spinner. So it takes time to insert data in database from inventory connector.

0 Likes 0 ·
Show more comments
Jeffrey Blattman avatar image
Jeffrey Blattman answered ojhatushar commented

If you need to iterate over inventory items do not use InventoryConnector. Here is the deprecation warning from the SDK:

/**
 * @deprecated Many merchants have a large inventory of items that cannot be retrieved in a
 * single shot due to binder and memory limits. As a precaution always use the
 * {@link com.clover.sdk.v3.inventory.InventoryContract} to retrieve the entire set of inventory
 * items.
 * <p/>
 * This method will return a maximum of 500 items before returning a fault.
 */
List<Item> getItems(out ResultStatus resultStatus);

Be aware that inventory can be VERY large. Hundreds of thousands of items. I'm not sure what you are doing, but if it involves copying Clover inventory to some other database it's probably not the correct approach.


10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Welcome to the
Clover Developer Community