Need help with a requirement automation through apigee

Need to schedule or run a batch job, at specific time of day, to access a proxy Rest API.  Then from the proxy api response need to fetch a field with data url. This data url has the data that has to be sent to a SFTP server and verify the acknowledgement response from ftp server.

Also, wanted to know if there is way to delay the a new serviceCallout until a field in the prior call, for example,  'status' changes to completed from in progress state.

Im new to Apigee and need quick help with this requirement. Not really sure if we can achieve this through apigee but my team works mainly through apigee only. 

0 5 119
5 REPLIES 5

You can do a Servicecallout based on the output from your backend of the apiproxy. But adding a delay to the Servicecallout is not a good idea.The longer you keep your proxy execution in hold, you are holding the resources for the proxy execution which degrades the performance of the overall platform. So you should look external to Apigee to implement the delay and schedule actions. 

Hope this helps.
Thanks.

Yes, so true Gana. I agree 100%.  I provided some further commentary on things that might help with scheduling and "delay", in my other answer. 


@AmulyaP wrote:

Need to schedule or run a batch job, at specific time of day, to access a proxy Rest API. Then from the proxy api response need to fetch a field with data url. This data url has the data that has to be sent to a SFTP server and verify the acknowledgement response from ftp server.


I understand that you want to schedule a regular, periodic task - like "one time per weekday at exactly 1135am" - to invoke some logic, in particular, you want to call a REST API. I guess you could call that REST API with Curl, or maybe some custom-built logic that you've coded in Python or Java or JavaScript or C# or whatever. If I were doing this I would consider using a task scheduler, something like GCP Cloud Scheduler. That's not Apigee, but it's part of Google Cloud. That thing is specifically designed for schedueld tasks, which is what I understand that you want. The right tool for that job.

Also, wanted to know if there is way to delay the a new serviceCallout until a field in the prior call, for example, 'status' changes to completed from in progress state.

The Apigee API Gateway is designed to be an HTTP proxy, to handle synchronous calls. A client calls in, Apigee gateway looks at the request, validates some credential (API key or token, or siggature, etc), maybe applies a rate limit, maybe does some routing decision, mediates the message (XML to JSON or vice versa), and then "proxies" that call to some upstream system. In other words it makes a NEW clal from the gateway to the upstream. There is no good way to introduce in Apigee gateway a "delay" or a "wait until field X in database Y changes from 1 to 2" before proceeding. It's all synchronous.

There IS another good tool to support asynchronous, long-running, or indefinitely running processes. You described a specific case , like delay the outbound call until the "status" of some other process transitions to "completed". The general problem is one of integration and process management - there may be delays, waits, polling, human interaction, data mapping... And for that general category of problem, again the Apigee Gateway is not the right tool. For that you want something like GCP App Integration.

Not really sure if we can achieve this through apigee but my team works mainly through apigee only.

You have good instincts. Apigee is a good tool for its main use case - proxying HTTP requests. The other things you want to do, are better handled using other tools.

Thank you so much for elaborated response. Really appreciate it 

GCP's Application Integration, as Dino mentioned, can easily handle this use case through a Schedule Trigger, and we have an SFTP Connector which can allow you to transfer the data to the SFTP server and then do whatever success or error checking you need to with appropriate actions based on the result.  It could, for example, notify the original requester that the SFTP upload is complete via an API call, a pubsub message or an email message...whichever the requestor system can accept.