This topic provides instructions for managing outbound HTTP calls in Scheduler for Pivotal Cloud Foundry (PCF).
You can use Scheduler for PCF to schedule execution of HTTP calls to external HTTP services. See the following sections to learn more about creating, running, and scheduling calls and viewing call history.
Note: If you want to use the Cloud Foundry Command Line Interface (cf CLI) for managing calls, you must install the Scheduler for PCF CLI plugin on your local machine. This plugin is packaged with the Scheduler for PCF tile on Pivotal Network. For more information, see the Prerequisites section of the Using Scheduler for PCF topic.
To execute tasks related to an app, create a call by running the
cf create-call APP-NAME CALL-NAME URL command, where:
APP-NAMEis the app you want to execute a task against.
CALL-NAMEis the name for your call.
URLis the URL to execute a HTTP POST call against.
You can execute a call manually by running the
cf run-call CALL-NAME command. This is often useful to test the configuration of a call prior to scheduling it for recurring execution.
See the following example:
$ cf run-call my-call
Enqueuing call my-call for app my-app in org my-org / space my-space as firstname.lastname@example.org... OK
You can schedule a call to execute at any time using a schedule expression. Scheduler for PCF requires Cron expressions in the
MIN HOUR DAY-OF-MONTH MONTH DAY-OF-WEEK format.
For example, to execute a call at noon every day, run the following command:
$ cf schedule-call my-call "0 12 ? * * "
A single call can have multiple schedules. Each schedule has a GUID to distinguish it from similar schedules.
You can use the cf CLI to list all calls in a space by running
cf calls. See the following example:
$ cf calls
Listing calls for org my-org / space my-space as email@example.com... Call Name App Name URL my-call my-app https://example.com OK
You can review schedules for all calls in a space by running
cf call-schedules. See the following example:
$ cf call-schedules
Getting scheduled calls for org my-org / space my-space as firstname.lastname@example.org... App Name: my-app my-call 2b69e0c2-9664-46bb-4817-54afcedbb65d 0 12 ? * * OK
You can review call history by running
cf call-history CALL-NAME. See the following example:
$ cf call-history my-call
Getting scheduled call history for my-call in org my-org / space my-space as email@example.com... 1 - 1 of 1 Total Results Execution GUID Execution State Scheduled Time Execution Start Time Execution End Time Exit Message d288a4ba-e0bc-48c9-969c-6ee79e380b20 SUCCEEDED Mon, 16 Oct 2017 12:10:55 UTC Mon, 16 Oct 2017 12:10:55 UTC Mon, 16 Oct 2017 12:10:55 UTC 201 - Created
You can delete a call by running
cf delete-call CALL-NAME. See the following example:
$ cf delete-call my-call
Really delete the call my-call with url https://example.com and all associated schedules and history?> [yN]:y OK
You can delete a specific schedule by running
cf delete-call-schedule SCHEDULE-GUID, where
SCHEDULE-GUID is the GUID found in the output of the
cf call-schedules command. See the following example:
$ cf delete-call-schedule 2b69e0c2-9664-46bb-4817-54afcedbb65d
Really delete the schedule 2b69e0c2-9664-46bb-4817-54afcedbb65d / 0 12 ? * * and all associated history?> [yN]: y OK