I need a cron job in which I check some logic then assign the result to global variables. Then, multiple proxies check this global variable to do some logic.
Could you help tell me how to create a cron job in APIGEE?. I see the thread: https://community.apigee.com/questions/27019/schedule-a-thread-in-apigee-edge.html
but do not know how to inject nodejs as suggested in the answer.
Could you help?. Thanks
There's no facility to run a cron job within Apigee Edge.
I can suggest Google Cloud Scheduler, which is designed for running scheduled tasks. Check it out!
There is no such thing as a "global variable" in Apigee Edge. There are things like KeyValueMaps and Caches and so on.
The task run by cloud scheduler could invoke API proxies that would then set data into those assets.
Thanks. How about the suggested answer in the link above i.e using nodejs to setup cronjob running in background?
The traditional Node.js support on Apigee Edge Cloud, as described in this topic, is deprecated. For details on the deprecation, see the Deprecations and retirements page. This feature will be retired in the future.
So I cannot recommend that.
You can of course build a cron job like thing in nodejs, using the hosted target. This package looks very popular. https://www.npmjs.com/package/cron That would run in your hosted target.
EDIT - two things
In short, HT is not a good basis upon which to build cron. Better advice: Use Google Cloud Scheduler or some other task-scheduler-as-a-service.
hosted target is interesting. However, it is attached to proxies as target server so can you confirm the life cycle of NodeJS app hosted in hosted target?. If I use cron job there, does the app continuously run and does not depend on any attached proxy lifecycle? I need this nodeJS app runs forever
You are correct - Hosted Target runs on google App Engine, with a min instances of 0. This means the hosted target process (in nodejs) can be reaped when there are no requests flowing through the system.
So my prior suggestion was off base. Let me correct that: It is inappropriate to try to use the Hosted Target feature as a foundation for an always-on, reliable cron, or task scheduler.
Fortunately, there are good options open to you. Google Cloud Scheduler is a good one.
There is no task scheduler or cron mechanism in Apigee Edge.
User | Count |
---|---|
7 | |
2 | |
2 | |
2 | |
1 |