apigee / apigee-edge-drupal

The Apigee Edge module enables you to integrate a Drupal 9 or 8 site with Apigee.
https://www.drupal.org/project/apigee_edge
GNU General Public License v2.0
32 stars 45 forks source link

seeking advice to automate Sync Api Products tasks #1043

Closed HollyWangUCLA closed 7 months ago

HollyWangUCLA commented 7 months ago

Is your feature request related to a problem? Please describe.

I have been manually run "Sync Field API Products" on a regular basis. If this task was skipped, the product list on the portal side will not display properly when project manager modified their products at the Apigee Edge side. The url to run this task is mysite/admin/config/apigee-edge/app-settings/general/sync

Screenshot: Screenshot 2024-02-15 at 10 40 08 AM

Screenshot 2024-02-15 at 10 42 13 AM

Describe the solution you would like

With more developers joined Apigee edge and more products were created, this manual task became routine and takes longer time to complete (>20 minutes).

Is there any suggesting to automate this task? for example, is that possible for me to create a crontab task to trigger this sync on a daily basis? Or is that possible for a backend cron job created through custom php code?

Thank you so much. Any suggestion will be appreciated.

shishir-intelli commented 7 months ago

Hi @HollyWangUCLA

In your custom module you can implement jobs. They will be executed whenever cron executes. There are two ways to do this using hook_cron and using queue workers.

For more information: https://api.drupal.org/api/drupal/core%21core.api.php/function/hook_cron/10 https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Annotation%21QueueWorker.php/class/QueueWorker/10

You can refer the below link for Background Developer Sync functionality which is similar to your use-case: "/admin/config/apigee-edge/developer-settings/sync"

HollyWangUCLA commented 7 months ago

shishir-intelli, Yes, developer_app sync works similar as developer sync. We do have a custom module which implement cron job to pull products from Edge and generate new categories. Any clue on where can I locate developer_app sync code in Edge module?

Thank you so much

shishir-intelli commented 7 months ago

Hi @HollyWangUCLA

Any clue on where can I locate developer_app sync code in Edge module?

I am not sure what exactly you are looking for, we don't have developer_app sync functionality in our module, It seems you have it in your custom module.

For developer sync you can refer : https://github.com/apigee/apigee-edge-drupal/blob/3.x/src/Job/DeveloperSync.php

HollyWangUCLA commented 7 months ago

I believe that this sync app field product function delivers with edge module admin/config/apigee-edge/app-settings/general/sync

shishir-intelli commented 7 months ago

It appears there is some confusion, Edge module doesn't include developer_app sync functionality. There is apigee_edge.settings.developer.sync: but not developer_app sync functionality. Check here https://github.com/apigee/apigee-edge-drupal/blob/3.x/apigee_edge.routing.yml

Could you please share us the file link for developer_app sync which you are referring to and the output of command composer show to understand better.

shishir-intelli commented 7 months ago

Are you using Stratus Meridian Developer Portal or Stratus Meridian module?

shishir-intelli commented 7 months ago

Hope this issue is resolved. Closing this issue, feel free to re-open for any further help.