Olingo2
| Deprecated: This olingo2 is deprecated and may be removed in a future release. |
Since Camel 2.14
Both producer and consumer are supported
| This component is deprecated since Camel 4.18 and will be removed in a future release. Apache Olingo project has been moved to the Apache Attic and is no longer maintained. |
| Starting with Camel 4.0, our project has migrated to JakartaEE. Some parts of Apache Olingo2 may depend on J2EE, which may result in unexpected behavior and other runtime problems. |
The Olingo2 component uses Apache Olingo version 2.0 APIs to interact with OData 2.0 compliant services. A number of popular commercial and enterprise vendors and products support the OData protocol. A sample list of supporting products can be found on the OData website.
The Olingo2 component supports reading feeds, delta feeds, entities, simple and complex properties, links, counts, using custom and OData system query parameters. It supports updating entities, properties, and association links. It also supports submitting queries and change requests as a single OData batch operation.
The component supports configuring HTTP connection parameters and headers for OData service connection. This allows configuring use of SSL, OAuth2.0, etc. as required by the target OData service.
Maven users will need to add the following dependency to their pom.xml for this component:
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-olingo2</artifactId>
<version>${camel-version}</version>
</dependency> 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 Olingo2 component supports the following options which are listed below.
| Name | Description | Default | Type |
|---|---|---|---|
The shared configuration of the endpoints: its options are the defaults of each endpoint of this component. | Olingo2Configuration | ||
The timeout in milliseconds to establish an HTTP connection. 0 means no timeout, and a negative value uses the system default. Not used when httpAsyncClientBuilder is set. | 30000 | int | |
The content type of the entries, feeds, properties and links in the requests and the responses, sent in the Content-Type and Accept headers: application/json for JSON, or application/atom+xml for Atom (XML). The service document, $metadata, $value and $count use their own content type. | application/json;charset=utf-8 | String | |
The Olingo EntityProviderReadProperties used to parse the feeds, entries, properties and function import results in the responses, batch responses included. | EntityProviderReadProperties | ||
The Olingo EntityProviderWriteProperties used to write the request data of create, update, patch, merge and batch, for example to omit the JSON wrapper or to write only the content of an entry. The service root in them is replaced with serviceUri, and merge always writes only the properties that are in the data. | EntityProviderWriteProperties | ||
Whether to leave out of the results the entries and values that this consumer or producer has already returned. An entry counts as returned before when its ID, URI and properties give the same hash code; the hash codes are kept in memory. | false | boolean | |
The HTTP headers to add to each request, as a Map of header names to values, such as an Authorization header. A header of the same name in endpointHttpHeaders overrides it. | Map | ||
The HTTP proxy to send the requests through, as an Apache HttpHost. Not used when httpAsyncClientBuilder is set. | HttpHost | ||
The base URI of the OData 2.0 service, such as http://services.odata.org/OData/OData.svc. The resource paths are relative to it. It must be set, on the endpoint or on the component. | String | ||
The socket timeout (SO_TIMEOUT) in milliseconds: the longest time without data between two packets while waiting for a response. 0 means no timeout, and a negative value uses the system default. Not used when httpAsyncClientBuilder is set. | 30000 | int | |
Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions (if possible) occurred while the Camel consumer is trying to pickup incoming messages, or the likes, will now be processed as a message and handled by the routing Error Handler. Important: This is only possible if the 3rd party component allows Camel to be alerted if an exception was thrown. Some components handle this internally only, and therefore bridgeErrorHandler is not possible. In other situations we may improve the Camel component to hook into the 3rd party component and make this possible for future releases. By default the consumer will use the org.apache.camel.spi.ExceptionHandler to deal with exceptions, that will be logged at WARN or ERROR level and ignored. | false | boolean | |
Whether the consumer sends each entry of a feed, or each element of a List result, as a message of its own. When false, the whole result is one message. | true | boolean | |
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 | |
A custom Apache HttpAsyncClientBuilder to create the HTTP client with. When set, connectTimeout, socketTimeout, proxy and sslContextParameters are not used, so set a socket timeout in the builder, otherwise a request can block forever. | HttpAsyncClientBuilder | ||
Not used: the component always creates an asynchronous HTTP client, from httpAsyncClientBuilder or from the other HTTP options. | HttpClientBuilder | ||
The SSL/TLS configuration of the HTTP client. When not set, the global SSL context parameters are used if useGlobalSslContextParameters is enabled on the component, else the JVM defaults. Not used when httpAsyncClientBuilder is set. | SSLContextParameters | ||
Whether to use the global SSL context parameters of the CamelContext when sslContextParameters is not set. | false | boolean |
Endpoint Options
The Olingo2 endpoint is configured using URI syntax:
olingo2:apiName/methodName
With the following path and query parameters:
Path Parameters
| Name | Description | Default | Type |
|---|---|---|---|
Required The API to use. The only API is DEFAULT, which can be left out of the URI, as in olingo2:read/Manufacturers. Enum values:
| Olingo2ApiName | ||
Required The operation to call: read, uread, create, update, patch, merge, delete or batch. A consumer supports only read and uread. A path after the operation in the URI, as in olingo2:read/Manufacturers, sets the resourcePath option. | String |
Query Parameters
| Name | Description | Default | Type |
|---|---|---|---|
The timeout in milliseconds to establish an HTTP connection. 0 means no timeout, and a negative value uses the system default. Not used when httpAsyncClientBuilder is set. | 30000 | int | |
The content type of the entries, feeds, properties and links in the requests and the responses, sent in the Content-Type and Accept headers: application/json for JSON, or application/atom+xml for Atom (XML). The service document, $metadata, $value and $count use their own content type. | application/json;charset=utf-8 | String | |
The Olingo EntityProviderReadProperties used to parse the feeds, entries, properties and function import results in the responses, batch responses included. | EntityProviderReadProperties | ||
The Olingo EntityProviderWriteProperties used to write the request data of create, update, patch, merge and batch, for example to omit the JSON wrapper or to write only the content of an entry. The service root in them is replaced with serviceUri, and merge always writes only the properties that are in the data. | EntityProviderWriteProperties | ||
Whether to leave out of the results the entries and values that this consumer or producer has already returned. An entry counts as returned before when its ID, URI and properties give the same hash code; the hash codes are kept in memory. | false | boolean | |
The HTTP headers to add to each request, as a Map of header names to values, such as an Authorization header. A header of the same name in endpointHttpHeaders overrides it. | Map | ||
Sets the name of a parameter to be passed in the exchange In Body. | String | ||
The HTTP proxy to send the requests through, as an Apache HttpHost. Not used when httpAsyncClientBuilder is set. | HttpHost | ||
The base URI of the OData 2.0 service, such as http://services.odata.org/OData/OData.svc. The resource paths are relative to it. It must be set, on the endpoint or on the component. | String | ||
The socket timeout (SO_TIMEOUT) in milliseconds: the longest time without data between two packets while waiting for a response. 0 means no timeout, and a negative value uses the system default. Not used when httpAsyncClientBuilder is set. | 30000 | int | |
If the polling consumer did not poll any files, you can enable this option to send an empty message (no body) instead. | false | boolean | |
Whether the consumer sends each entry of a feed, or each element of a List result, as a message of its own. When false, the whole result is one message. | true | boolean | |
Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions (if possible) occurred while the Camel consumer is trying to pickup incoming messages, or the likes, will now be processed as a message and handled by the routing Error Handler. Important: This is only possible if the 3rd party component allows Camel to be alerted if an exception was thrown. Some components handle this internally only, and therefore bridgeErrorHandler is not possible. In other situations we may improve the Camel component to hook into the 3rd party component and make this possible for future releases. By default the consumer will use the org.apache.camel.spi.ExceptionHandler to deal with exceptions, that will be logged at WARN or ERROR level and ignored. | false | boolean | |
To let the consumer use a custom ExceptionHandler. Notice if the option bridgeErrorHandler is enabled then this option is not in use. By default the consumer will deal with exceptions, that will be logged at WARN or ERROR level and ignored. | ExceptionHandler | ||
Sets the exchange pattern when the consumer creates an exchange. Enum values:
| ExchangePattern | ||
A pluggable org.apache.camel.PollingConsumerPollingStrategy allowing you to provide your custom implementation to control error handling usually occurred during the poll operation before an Exchange have been created and being routed in Camel. | PollingConsumerPollStrategy | ||
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 | |
A custom Apache HttpAsyncClientBuilder to create the HTTP client with. When set, connectTimeout, socketTimeout, proxy and sslContextParameters are not used, so set a socket timeout in the builder, otherwise a request can block forever. | HttpAsyncClientBuilder | ||
Not used: the component always creates an asynchronous HTTP client, from httpAsyncClientBuilder or from the other HTTP options. | HttpClientBuilder | ||
The number of subsequent error polls (failed due some error) that should happen before the backoffMultipler should kick-in. | int | ||
The number of subsequent idle polls that should happen before the backoffMultipler should kick-in. | int | ||
To let the scheduled polling consumer backoff if there has been a number of subsequent idles/errors in a row. The multiplier is then the number of polls that will be skipped before the next actual attempt is happening again. When this option is in use then backoffIdleThreshold and/or backoffErrorThreshold must also be configured. | int | ||
Milliseconds before the next poll. | 500 | long | |
If greedy is enabled, then the ScheduledPollConsumer will run immediately again, if the previous run polled 1 or more messages. | false | boolean | |
How long a poll may run before the health check of the consumer reports DOWN. The health check is otherwise based on the polls that are done, so it stays UP while a poll hangs, for example on a read without timeout from a connection that went silent. A poll includes routing the messages it polled, so set this above the longest poll you expect. The poll is not interrupted. The value is in millis (not affected by timeUnit). The default 0 turns this off. | 0 | long | |
Milliseconds before the first poll starts. | 1000 | long | |
Specifies a maximum limit of number of fires. So if you set it to 1, the scheduler will only fire once. If you set it to 5, it will only fire five times. A value of zero or negative means fire forever. | 0 | long | |
The consumer logs a start/complete log line when it polls. This option allows you to configure the logging level for that. Enum values:
| TRACE | LoggingLevel | |
Allows for configuring a custom/shared thread pool to use for the consumer. By default each consumer has its own single threaded thread pool. | ScheduledExecutorService | ||
To use a cron scheduler from either camel-spring or camel-quartz component. Use value spring or quartz for built in scheduler. | none | Object | |
To configure additional properties when using a custom scheduler or any of the Quartz, Spring based scheduler. This is a multi-value option with prefix: scheduler. | Map | ||
Whether the scheduler should be auto started. | true | boolean | |
Time unit for initialDelay and delay options. Enum values:
| MILLISECONDS | TimeUnit | |
Controls if fixed delay or fixed rate is used. See ScheduledExecutorService in JDK for details. | true | boolean | |
The SSL/TLS configuration of the HTTP client. When not set, the global SSL context parameters are used if useGlobalSslContextParameters is enabled on the component, else the JVM defaults. Not used when httpAsyncClientBuilder is set. | SSLContextParameters |
API Parameters (1 APIs)
The Olingo2 endpoint is an API-based component and has additional parameters based on which API name and API method is used. The API name and API method is located in the endpoint URI as the apiName/methodName path parameters:
olingo2:apiName/methodName
There are 1 API names as listed in the table below:
| API Name | Type | Description |
|---|---|---|
Both | The client API of the Olingo2 component: read, create, update, patch, merge, delete and batch requests to an OData service |
Each API is documented in the following sections to come.
API: DEFAULT
Both producer and consumer are supported
The DEFAULT API is defined in the syntax as follows:
olingo2:DEFAULT/methodName?[parameters] The 8 method(s) is(are) listed in the table below, followed by detailed syntax for each method. (API methods can have a shorthand alias name which can be used in the syntax instead of the name)
| Method | Alias | Description |
|---|---|---|
Sends a batch request, with its query and change set parts, to the $batch resource of the service | ||
Creates an OData resource, such as an entry in an entity set, with HTTP POST | ||
Deletes an OData resource and invokes the callback with the HTTP status code of the response | ||
Updates an OData resource with HTTP MERGE, sending only the properties that are in the data | ||
Updates an OData resource with HTTP PATCH | ||
Reads an OData resource and invokes the callback with the parsed result | ||
Replaces an OData resource with HTTP PUT | ||
Reads an OData resource and invokes the callback with the unparsed response body as an InputStream |
Method batch
Signatures:
-
void batch(org.apache.olingo.odata2.api.edm.Edm edm, java.util.Map<String, String> endpointHttpHeaders, Object data, org.apache.camel.component.olingo2.api.Olingo2ResponseHandler<java.util.List<org.apache.camel.component.olingo2.api.batch.Olingo2BatchResponse>> responseHandler);
The olingo2/batch API method has the parameters listed in the table below:
| Parameter | Description | Type |
|---|---|---|
data | The List of Olingo2BatchRequest parts of the batch, in order: each Olingo2BatchQueryRequest is a query part, and consecutive Olingo2BatchChangeRequest parts go in one change set | Object |
edm | The Edm (entity data model) of the service, as read from its $metadata; the endpoint reads it once and sets it itself | Edm |
endpointHttpHeaders | The HTTP headers to add to this request, as a Map of header names to values; they override the headers of the same name in httpHeaders | Map |
responseHandler | The callback that receives the List of Olingo2BatchResponse, one for each part, or the failure; the consumer and producer of the component set their own | Olingo2ResponseHandler |
Method create
Signatures:
-
void create(org.apache.olingo.odata2.api.edm.Edm edm, String resourcePath, java.util.Map<String, String> endpointHttpHeaders, Object data, org.apache.camel.component.olingo2.api.Olingo2ResponseHandler responseHandler);
The olingo2/create API method has the parameters listed in the table below:
| Parameter | Description | Type |
|---|---|---|
data | The data to send: a Map of the property names and values for an entry or a complex property, the Java value of a simple property, a Map of the key property names and values of the target entry for a link, or a List of such Maps for links | Object |
edm | The Edm (entity data model) of the service, as read from its $metadata; the endpoint reads it once and sets it itself | Edm |
endpointHttpHeaders | The HTTP headers to add to this request, as a Map of header names to values; they override the headers of the same name in httpHeaders | Map |
resourcePath | The path of the resource to create, such as an entity set or the $links of an entry, relative to serviceUri; a keyPredicate option or header is appended to it in parentheses | String |
responseHandler | The callback that receives the parsed result, such as the created entry, or the HTTP status code when the response has no content, or the failure; the consumer and producer of the component set their own | Olingo2ResponseHandler |
Method delete
Signatures:
-
void delete(String resourcePath, java.util.Map<String, String> endpointHttpHeaders, org.apache.camel.component.olingo2.api.Olingo2ResponseHandler<org.apache.olingo.odata2.api.commons.HttpStatusCodes> responseHandler);
The olingo2/delete API method has the parameters listed in the table below:
| Parameter | Description | Type |
|---|---|---|
endpointHttpHeaders | The HTTP headers to add to this request, as a Map of header names to values; they override the headers of the same name in httpHeaders | Map |
resourcePath | The path of the resource to delete, such as an entry or a link, relative to serviceUri; a keyPredicate option or header is appended to it in parentheses | String |
responseHandler | The callback that receives the HTTP status code of the response, or the failure; the consumer and producer of the component set their own | Olingo2ResponseHandler |
Method merge
Signatures:
-
void merge(org.apache.olingo.odata2.api.edm.Edm edm, String resourcePath, java.util.Map<String, String> endpointHttpHeaders, Object data, org.apache.camel.component.olingo2.api.Olingo2ResponseHandler responseHandler);
The olingo2/merge API method has the parameters listed in the table below:
| Parameter | Description | Type |
|---|---|---|
data | The data to send: a Map of the property names and values for an entry or a complex property, the Java value of a simple property, a Map of the key property names and values of the target entry for a link, or a List of such Maps for links | Object |
edm | The Edm (entity data model) of the service, as read from its $metadata; the endpoint reads it once and sets it itself | Edm |
endpointHttpHeaders | The HTTP headers to add to this request, as a Map of header names to values; they override the headers of the same name in httpHeaders | Map |
resourcePath | The path of the resource to update, such as an entry, a property or a link, relative to serviceUri; a keyPredicate option or header is appended to it in parentheses | String |
responseHandler | The callback that receives the HTTP status code of the response, or the parsed result when the response has content, or the failure; the consumer and producer of the component set their own | Olingo2ResponseHandler |
Method patch
Signatures:
-
void patch(org.apache.olingo.odata2.api.edm.Edm edm, String resourcePath, java.util.Map<String, String> endpointHttpHeaders, Object data, org.apache.camel.component.olingo2.api.Olingo2ResponseHandler responseHandler);
The olingo2/patch API method has the parameters listed in the table below:
| Parameter | Description | Type |
|---|---|---|
data | The data to send: a Map of the property names and values for an entry or a complex property, the Java value of a simple property, a Map of the key property names and values of the target entry for a link, or a List of such Maps for links | Object |
edm | The Edm (entity data model) of the service, as read from its $metadata; the endpoint reads it once and sets it itself | Edm |
endpointHttpHeaders | The HTTP headers to add to this request, as a Map of header names to values; they override the headers of the same name in httpHeaders | Map |
resourcePath | The path of the resource to update, such as an entry, a property or a link, relative to serviceUri; a keyPredicate option or header is appended to it in parentheses | String |
responseHandler | The callback that receives the HTTP status code of the response, or the parsed result when the response has content, or the failure; the consumer and producer of the component set their own | Olingo2ResponseHandler |
Method read
Signatures:
-
void read(org.apache.olingo.odata2.api.edm.Edm edm, String resourcePath, java.util.Map<String, String> queryParams, java.util.Map<String, String> endpointHttpHeaders, org.apache.camel.component.olingo2.api.Olingo2ResponseHandler responseHandler);
The olingo2/read API method has the parameters listed in the table below:
| Parameter | Description | Type |
|---|---|---|
edm | The Edm (entity data model) of the service, as read from its $metadata; the endpoint reads it once and sets it itself | Edm |
endpointHttpHeaders | The HTTP headers to add to this request, as a Map of header names to values; they override the headers of the same name in httpHeaders | Map |
queryParams | The query options of the request, as a Map of names to values, such as $filter, $orderby, $top, $skip, $expand and $select, or custom query options; the values are URL encoded | Map |
resourcePath | The path of the resource to read, such as $metadata, an entity set, an entry, a property, $value, $count or $links, relative to serviceUri; a keyPredicate option or header is appended to it in parentheses | String |
responseHandler | The callback that receives the parsed result, or the failure; the consumer and producer of the component set their own | Olingo2ResponseHandler |
Method update
Signatures:
-
void update(org.apache.olingo.odata2.api.edm.Edm edm, String resourcePath, java.util.Map<String, String> endpointHttpHeaders, Object data, org.apache.camel.component.olingo2.api.Olingo2ResponseHandler responseHandler);
The olingo2/update API method has the parameters listed in the table below:
| Parameter | Description | Type |
|---|---|---|
data | The data to send: a Map of the property names and values for an entry or a complex property, the Java value of a simple property, a Map of the key property names and values of the target entry for a link, or a List of such Maps for links | Object |
edm | The Edm (entity data model) of the service, as read from its $metadata; the endpoint reads it once and sets it itself | Edm |
endpointHttpHeaders | The HTTP headers to add to this request, as a Map of header names to values; they override the headers of the same name in httpHeaders | Map |
resourcePath | The path of the resource to update, such as an entry, a property or a link, relative to serviceUri; a keyPredicate option or header is appended to it in parentheses | String |
responseHandler | The callback that receives the HTTP status code of the response, or the parsed result when the response has content, or the failure; the consumer and producer of the component set their own | Olingo2ResponseHandler |
Method uread
Signatures:
-
void uread(org.apache.olingo.odata2.api.edm.Edm edm, String resourcePath, java.util.Map<String, String> queryParams, java.util.Map<String, String> endpointHttpHeaders, org.apache.camel.component.olingo2.api.Olingo2ResponseHandler<java.io.InputStream> responseHandler);
The olingo2/uread API method has the parameters listed in the table below:
| Parameter | Description | Type |
|---|---|---|
edm | The Edm (entity data model) of the service, as read from its $metadata; the endpoint reads it once and sets it itself | Edm |
endpointHttpHeaders | The HTTP headers to add to this request, as a Map of header names to values; they override the headers of the same name in httpHeaders | Map |
queryParams | The query options of the request, as a Map of names to values, such as $filter, $orderby, $top, $skip, $expand and $select, or custom query options; the values are URL encoded | Map |
resourcePath | The path of the resource to read, such as $metadata, an entity set, an entry, a property, $value, $count or $links, relative to serviceUri; a keyPredicate option or header is appended to it in parentheses | String |
responseHandler | The callback that receives the response body as an InputStream, or the failure; the consumer and producer of the component set their own | Olingo2ResponseHandler |
In addition to the parameters above, the olingo2 API can also use any of the Query Parameters.
Any of the parameters can be provided in either the endpoint URI, or dynamically in a message header. The message header name must be of the format CamelOlingo2.parameter. The inBody parameter overrides message header, i.e., the endpoint parameter inBody=myParameterNameHere would override a CamelOlingo2.myParameterNameHere header.
Message Headers
The Olingo2 component supports the following message header(s), which is/are listed below:
| Name | Description | Default | Type |
|---|---|---|---|
CamelOlingo2.responseHttpHeaders (producer) Constant: | The HTTP headers of the response, as a Map of header names to values. | Map |
Message Body
The message body at each side of the Olingo2 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 |
|---|---|---|
Consumer |
| The result of read for the resourcePath, as in the producer: a feed is split into one message per ODataEntry and the $links of an entry into one message per link URI; with splitResult=false the ODataFeed or the List comes in one message. uread gives the response unparsed as a stream.
|
Producer input |
| create, update, patch, merge and batch send the body as their data, passed as it is without type conversion: a Map of the property names and values for an entry or a complex property, the Java value of a simple property, a Map of the key for a link and a List of such Maps for links, and a List of Olingo2BatchRequest for batch. JSON text, bytes or a stream fails: unmarshal it to a Map first. read, uread and delete do not use the body.
Not known when |
Producer output |
| read gives the Olingo object of the resource: an ODataFeed, an ODataEntry, the Edm of $metadata or the ServiceDocument; a Map for a property, the Java value for $value, a Long for $count, the URI text of a link and a List of them for $links. uread gives the response as a stream. create gives the created ODataEntry, or the HttpStatusCodes when the response has no content; update, patch, merge and delete the HttpStatusCodes, and batch a List of Olingo2BatchResponse. With filterAlreadySeen, a result read before is null.
|
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.
| This is an API-based component, so per-call parameters can be supplied through |
Usage
Endpoint HTTP Headers
The component level configuration property httpHeaders supplies static HTTP header information. However, some systems require dynamic header information to be passed to and received from the endpoint. A sample use case would be systems that require dynamic security tokens. The endpointHttpHeaders and responseHttpHeaders endpoint properties provide this capability. Set headers that need to be passed to the endpoint in the CamelOlingo2.endpointHttpHeaders property and the response headers will be returned in a CamelOlingo2.responseHttpHeaders property. Both properties are of the type java.util.Map<String, String>.
OData Resource Type Mapping
The result of read endpoint and data type of data option depends on the OData resource being queried, created or modified.
| OData Resource Type | Resource URI from resourcePath and keyPredicate | In or Out Body Type |
|---|---|---|
Entity data model | $metadata |
|
Service document | / |
|
OData feed | <entity-set> |
|
OData entry | <entity-set>(<key-predicate>) |
|
Simple property | <entity-set>(<key-predicate>)/<simple-property> | The appropriate Java data type as described by Olingo EdmProperty |
Simple property value | <entity-set>(<key-predicate>)/<simple-property>/$value | The appropriate Java data type as described by Olingo EdmProperty |
Complex property | <entity-set>(<key-predicate>)/<complex-property> | java.util.Map<String, Object> |
Zero or one association link | <entity-set>(<key-predicate>/$link/<one-to-one-entity-set-property> | String for response |
Zero or many association links | <entity-set>(<key-predicate>/$link/<one-to-many-entity-set-property> |
|
Count | <resource-uri>/$count | java.lang.Long |
Examples
The following route reads top 5 entries from the Manufacturer feed ordered by ascending Name property.
from("direct:...")
.setHeader("CamelOlingo2.$top", constant("5"))
.to("olingo2://read/Manufacturers?$orderby=Name%20asc"); The following route reads Manufacturer entry using the key property value in incoming id header.
from("direct:...")
.setHeader("CamelOlingo2.keyPredicate", header("id"))
.to("olingo2://read/Manufacturers"); The following route creates Manufacturer entry using the java.util.Map<String, Object> in the body message.
-
Java
-
XML
-
YAML
from("direct:...")
.to("olingo2://create/Manufacturers"); <route>
<from uri="direct:..."/>
<to uri="olingo2://create/Manufacturers"/>
</route> - route:
from:
uri: direct:...
steps:
- to:
uri: olingo2://create/Manufacturers The following route polls Manufacturer delta feed every 30 seconds. The bean blah updates the bean paramsBean to add an updated !deltatoken property with the value returned in the ODataDeltaFeed result. Since the initial delta token is not known, the consumer endpoint will produce an ODataFeed value the first time, and ODataDeltaFeed on subsequent polls.
-
Java
-
XML
-
YAML
from("olingo2://read/Manufacturers?queryParams=#paramsBean&timeUnit=SECONDS&delay=30")
.to("bean:blah"); <route>
<from uri="olingo2://read/Manufacturers?queryParams=#paramsBean&timeUnit=SECONDS&delay=30"/>
<to uri="bean:blah"/>
</route> - route:
from:
uri: olingo2://read/Manufacturers
parameters:
queryParams: "#paramsBean"
timeUnit: SECONDS
delay: 30
steps:
- to:
uri: bean:blah