Workday
Since Camel 3.1
Only producer is supported
The Workday component reads custom reports through Workday Report-as-a-Service (RaaS) and resources of the Workday REST API.
In order to use the Workday component, Maven users will need to add the following dependency to their pom.xml:
pom.xml
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-workday</artifactId>
<version>x.x.x</version>
<!-- use the same version as your Camel core version -->
</dependency> Usage
The entity is report (a Workday report as a service) or commonAPI (the Workday REST API), and the path is the path of the report or of the API resource. The credentials come from the API client that Workday generates for the integration.
The following route reads a report every hour. The body is the JSON of the report:
- route:
from:
uri: timer:employees
parameters:
period: 3600000
steps:
- to:
uri: workday:report:/ISU_Camel/Custom_Report_Employees
parameters:
host: impl.workday.com
tenant: "{{workday.tenant}}"
clientId: "{{workday.client-id}}"
clientSecret: "{{workday.client-secret}}"
tokenRefresh: "{{workday.token-refresh}}"
- log:
message: "${body}" The following route reads the workers through the Common API:
- route:
from:
uri: direct:workers
steps:
- to:
uri: workday:commonAPI:/workers
parameters:
host: impl.workday.com
tenant: "{{workday.tenant}}"
clientId: "{{workday.client-id}}"
clientSecret: "{{workday.client-secret}}"
tokenRefresh: "{{workday.token-refresh}}" Configuring Options
Camel components are configured on two separate levels:
-
component level
-
endpoint level
Configuring Component Options
At the component level, you set general and shared configurations that are, then, inherited by the endpoints. It is the highest configuration level.
For example, a component may have security settings, credentials for authentication, urls for network connection and so forth.
Some components only have a few options, and others may have many. Because components typically have pre-configured defaults that are commonly used, then you may often only need to configure a few options on a component; or none at all.
You can configure components using:
-
the Component DSL.
-
in a configuration file (
application.properties,*.yamlfiles, etc). -
directly in the Java code.
Configuring Endpoint Options
You usually spend more time setting up endpoints because they have many options. These options help you customize what you want the endpoint to do. The options are also categorized into whether the endpoint is used as a consumer (from), as a producer (to), or both.
Configuring endpoints is most often done directly in the endpoint URI as path and query parameters. You can also use the Endpoint DSL and DataFormat DSL as a type safe way of configuring endpoints and data formats in Java.
A good practice when configuring options is to use Property Placeholders.
Property placeholders provide a few benefits:
-
They help prevent using hardcoded urls, port numbers, sensitive information, and other settings.
-
They allow externalizing the configuration from the code.
-
They help the code to become more flexible and reusable.
The following two sections list all the options, firstly for the component followed by the endpoint.
Component Options
The Workday component supports the following options which are listed below.
| Name | Description | Default | Type |
|---|---|---|---|
Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel’s routing error handlers. Beware that when the first message is processed then creating and starting the producer may take a little time and prolong the total processing time of the processing. | false | boolean | |
Whether autowiring is enabled. This is used for automatic autowiring options (the option must be marked as autowired) by looking up in the registry to find if there is a single instance of matching type, which then gets configured on the component. This can be used for automatic configuring JDBC data sources, JMS connection factories, AWS Clients, etc. | true | boolean |
Endpoint Options
The Workday endpoint is configured using URI syntax:
workday:entity:path
With the following path and query parameters:
Path Parameters
| Name | Description | Default | Type |
|---|---|---|---|
Required What the producer reads: report reads a custom report through Workday Report-as-a-Service (RaaS), and commonAPI reads a resource of the Workday REST API (Common API v1). Enum values:
| Entity | ||
Required The path of what to read. For report, the path of the custom report as /\{report owner}/\{report name}, which is added to https://{host}/ccx/service/customreport2/{tenant}; the endpoint parameters that are not options of this component are added to the report URL as query parameters. For commonAPI, the path of a REST API resource, such as /workers or /workers/{ID} with a 32-character Workday ID, which is added to https://{host}/ccx/api/v1/{tenant}; only the resources the component knows are accepted. | String |
Query Parameters
| Name | Description | Default | Type |
|---|---|---|---|
Required The host name of the Workday API service of the tenant, such as wd2-impl-services1.workday.com, without scheme or path. The component always calls it over HTTPS. | String | ||
The output format that Report-as-a-Service is asked for, sent as the format query parameter of the report URL. Only used by the report entity. Enum values:
| json | String | |
Required The name of the Workday tenant, which is part of the token, report and REST API URLs. | String | ||
Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel’s routing error handlers. Beware that when the first message is processed then creating and starting the producer may take a little time and prolong the total processing time of the processing. | false | boolean | |
The Apache HttpClient connection pool (PoolingHttpClientConnectionManager) that is used for the token requests and the Workday calls. By default each endpoint has its own pool, with the HttpClient defaults of 25 connections in total and 5 per route. | PoolingHttpClientConnectionManager | ||
Required The client ID of the API client that is registered in Workday for the integration. It is sent with the client secret (HTTP Basic authentication) to the OAuth 2.0 token endpoint of the tenant. | String | ||
Required The client secret of the API client that is registered in Workday for the integration. It is sent with the client ID (HTTP Basic authentication) to the OAuth 2.0 token endpoint of the tenant. | String | ||
Required The OAuth 2.0 refresh token that Workday generated for the integration system user. Before each call the component exchanges it for an access token at https://{host}/ccx/oauth2/{tenant}/token. | String |
Message Headers
The Workday component supports the following message header(s), which is/are listed below:
| Name | Description | Default | Type |
|---|---|---|---|
| Constant: | The URL that the producer called: the report URL with its query parameters, or the URL of the REST API resource. | String |
Message Body
The message body at each side of the Workday component: Consumer is the body of the messages the consumer creates, Consumer reply the bodies a consumer that answers its caller can reply with, Producer input the bodies the producer can send or write, and Producer output the body after the producer.
| Side | Body | Description |
|---|---|---|
Producer input |
| The body is not read: the report or the API resource is the path, and the report parameters are the other options of the endpoint. |
Producer output |
| The JSON that Workday answers, as text: the report (in the reportFormat) or the API resource; unmarshal it to work with its fields. The URL called is in the CamelWorkdayURL header. |
The bodies are the ones with the default options. A side that is not listed is not known, and tooling does not guess it. The carriers, the sides and the tools that use them are described in Message Body Types.