Skip to content

tutorial scheduled rest call

Raymond Meester edited this page Jan 21, 2024 · 15 revisions

In this tutorial you learn how to create a request/reply flow calling a REST API through a scheduler. We start with the flow created in the Quick Start.

Step 1: Clone flow

  • Like in tutorial1 clone the 'TestFlow'.

CloneFlow

Step 2: Configure the flow

  • Give the flow the name 'REST'.
  • Set the component of the SOURCE step to "scheduler".
  • Set the path to "foo".
  • Set the URI option "Delay" to "60000".

This means the connector will run every 60 seconds. Triggering the Source step.

SchedulerEndpoint

  • Choose Add --> Action from the Source step.
  • Set the component of the ACTION step to "get".
  • Set the path to "api/v1/employees".
  • Set the option "Host" to "http://dummy.restapiexample.com".

RestEndpoint

After the changes you can save the flow.

Step 3: Test the flow

  • Start the flow 'REST'
  • Check the folder "C:/messages/out" (after 60 seconds a file with content should appear on disk)

Tip: Check the log file to see what's happening on the background. Administration --> Log viewer.

More on logs files.

Explanation on the GET Step

GET, POST or PUT actions can be used to host a REST endpoint (as a server) or call a REST Endpoint (as a client). More info you can find on the REST Component page.


next tutorial to create a simple Camel route.

Clone this wiki locally