Camel Components

Olingo4

Deprecated: This olingo4 is deprecated and may be removed in a future release.

Since Camel 2.19

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.

The Olingo4 component uses Apache Olingo version 4.0 APIs to interact with OData 4.0 compliant service. Since version 4.0, OData is an OASIS standard and a number of popular open source and commercial vendors and products support this protocol. A sample list of supporting products can be found on the OData website.

The Olingo4 component supports reading entity sets, entities, simple and complex properties, counts, using custom and OData system query parameters. It supports creating, updating, patching, merging and deleting entities, and calling actions. 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-olingo4</artifactId>
    <version>x.x.x</version>
    <!-- use the same version as your Camel core version -->
</dependency>

URI format

olingo4://<method-name>/<resource-path>?[options]

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, *.yaml files, 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 Olingo4 component supports the following options which are listed below.

Name Description Default Type

configuration (common)

The configuration shared by the endpoints of this component.

Olingo4Configuration

connectTimeout (common)

The timeout in milliseconds to establish the HTTP connection to the service. 0 means no timeout. Not used when httpAsyncClientBuilder is set.

30000

int

contentType (common)

The content type of the OData payloads: application/json or an XML type such as application/atom+xml. It sets the Accept header of the requests and the format of the request bodies made from a ClientEntity, and the responses of read are parsed in this format. A JSON String body is always sent as application/json, and $metadata, the service document, $count and $value use their own content types.

application/json;charset=utf-8

String

filterAlreadySeen (common)

Whether to leave out the results that this consumer or producer has already returned: a result counts as seen when an earlier one had the same hash code, which Olingo computes from the content. The hash codes are kept in memory. For an entity set or a collection, only the entities or values not seen before are kept; a single result seen before is dropped (the producer returns null).

false

boolean

httpHeaders (common)

HTTP headers to add to every request to the service, for example an Authorization header. They replace the headers of the same name that the component sets.

Map

proxy (common)

The HTTP proxy to send the requests through, as an org.apache.http.HttpHost. Not used when httpAsyncClientBuilder is set.

HttpHost

serviceUri (common)

The base URI of the OData service, for example https://services.odata.org/TripPinRESTierService. The resource paths are relative to it.

String

socketTimeout (common)

The socket timeout (SO_TIMEOUT) in milliseconds: the longest time to wait for data from the service between two packets. 0 means no timeout. Not used when httpAsyncClientBuilder is set.

30000

int

bridgeErrorHandler (consumer)

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

splitResult (consumer)

Whether the consumer sends one message per entity of an entity set, or per value of a collection, instead of one message with the whole result.

true

boolean

lazyStartProducer (producer)

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

autowiredEnabled (advanced)

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

httpAsyncClientBuilder (advanced)

A custom Apache HttpAsyncClient builder to create the HTTP client with. When set, connectTimeout, socketTimeout, proxy and sslContextParameters are not used. Set a socket timeout on the builder, otherwise a request can wait forever for the response.

HttpAsyncClientBuilder

httpClientBuilder (advanced)

A custom Apache HttpClient builder for a synchronous HTTP client. Currently not used: the component always creates an asynchronous client, from httpAsyncClientBuilder or from connectTimeout, socketTimeout, proxy and sslContextParameters.

HttpClientBuilder

sslContextParameters (security)

The SSL/TLS configuration for HTTPS connections to the service. When not set, the global SSL context parameters are used if useGlobalSslContextParameters is enabled, otherwise the default SSL context of the JVM. Not used when httpAsyncClientBuilder is set.

SSLContextParameters

useGlobalSslContextParameters (security)

Whether to use the global SSL context parameters of the CamelContext when sslContextParameters is not set.

false

boolean

Endpoint Options

The Olingo4 endpoint is configured using URI syntax:

olingo4:apiName/methodName

With the following path and query parameters:

Path Parameters

Name Description Default Type

apiName (common)

Required The API to use. The component has only the DEFAULT API, which can be left out of the URI.

Enum values:

  • DEFAULT

Olingo4ApiName

methodName (common)

Required The operation to call: read, uread, create, update, patch, merge, delete, batch or action. The consumer supports only read and uread.

String

Query Parameters

Name Description Default Type

connectTimeout (common)

The timeout in milliseconds to establish the HTTP connection to the service. 0 means no timeout. Not used when httpAsyncClientBuilder is set.

30000

int

contentType (common)

The content type of the OData payloads: application/json or an XML type such as application/atom+xml. It sets the Accept header of the requests and the format of the request bodies made from a ClientEntity, and the responses of read are parsed in this format. A JSON String body is always sent as application/json, and $metadata, the service document, $count and $value use their own content types.

application/json;charset=utf-8

String

filterAlreadySeen (common)

Whether to leave out the results that this consumer or producer has already returned: a result counts as seen when an earlier one had the same hash code, which Olingo computes from the content. The hash codes are kept in memory. For an entity set or a collection, only the entities or values not seen before are kept; a single result seen before is dropped (the producer returns null).

false

boolean

httpHeaders (common)

HTTP headers to add to every request to the service, for example an Authorization header. They replace the headers of the same name that the component sets.

Map

inBody (common)

Sets the name of a parameter to be passed in the exchange In Body.

String

proxy (common)

The HTTP proxy to send the requests through, as an org.apache.http.HttpHost. Not used when httpAsyncClientBuilder is set.

HttpHost

serviceUri (common)

The base URI of the OData service, for example https://services.odata.org/TripPinRESTierService. The resource paths are relative to it.

String

socketTimeout (common)

The socket timeout (SO_TIMEOUT) in milliseconds: the longest time to wait for data from the service between two packets. 0 means no timeout. Not used when httpAsyncClientBuilder is set.

30000

int

sendEmptyMessageWhenIdle (consumer)

If the polling consumer did not poll any files, you can enable this option to send an empty message (no body) instead.

false

boolean

splitResult (consumer)

Whether the consumer sends one message per entity of an entity set, or per value of a collection, instead of one message with the whole result.

true

boolean

bridgeErrorHandler (consumer (advanced))

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

exceptionHandler (consumer (advanced))

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

exchangePattern (consumer (advanced))

Sets the exchange pattern when the consumer creates an exchange.

Enum values:

  • InOnly

  • InOut

ExchangePattern

pollStrategy (consumer (advanced))

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

lazyStartProducer (producer (advanced))

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

httpAsyncClientBuilder (advanced)

A custom Apache HttpAsyncClient builder to create the HTTP client with. When set, connectTimeout, socketTimeout, proxy and sslContextParameters are not used. Set a socket timeout on the builder, otherwise a request can wait forever for the response.

HttpAsyncClientBuilder

httpClientBuilder (advanced)

A custom Apache HttpClient builder for a synchronous HTTP client. Currently not used: the component always creates an asynchronous client, from httpAsyncClientBuilder or from connectTimeout, socketTimeout, proxy and sslContextParameters.

HttpClientBuilder

backoffErrorThreshold (scheduler)

The number of subsequent error polls (failed due some error) that should happen before the backoffMultipler should kick-in.

int

backoffIdleThreshold (scheduler)

The number of subsequent idle polls that should happen before the backoffMultipler should kick-in.

int

backoffMultiplier (scheduler)

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

delay (scheduler)

Milliseconds before the next poll.

500

long

greedy (scheduler)

If greedy is enabled, then the ScheduledPollConsumer will run immediately again, if the previous run polled 1 or more messages.

false

boolean

healthCheckMaxPollDuration (scheduler)

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

initialDelay (scheduler)

Milliseconds before the first poll starts.

1000

long

repeatCount (scheduler)

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

runLoggingLevel (scheduler)

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

  • DEBUG

  • INFO

  • WARN

  • ERROR

  • OFF

TRACE

LoggingLevel

scheduledExecutorService (scheduler)

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

scheduler (scheduler)

To use a cron scheduler from either camel-spring or camel-quartz component. Use value spring or quartz for built in scheduler.

none

Object

schedulerProperties (scheduler)

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

startScheduler (scheduler)

Whether the scheduler should be auto started.

true

boolean

timeUnit (scheduler)

Time unit for initialDelay and delay options.

Enum values:

  • NANOSECONDS

  • MICROSECONDS

  • MILLISECONDS

  • SECONDS

  • MINUTES

  • HOURS

  • DAYS

MILLISECONDS

TimeUnit

useFixedDelay (scheduler)

Controls if fixed delay or fixed rate is used. See ScheduledExecutorService in JDK for details.

true

boolean

sslContextParameters (security)

The SSL/TLS configuration for HTTPS connections to the service. When not set, the global SSL context parameters are used if useGlobalSslContextParameters is enabled, otherwise the default SSL context of the JVM. Not used when httpAsyncClientBuilder is set.

SSLContextParameters

API Parameters (1 APIs)

The Olingo4 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:

olingo4:apiName/methodName

There are 1 API names as listed in the table below:

API Name Type Description

DEFAULT

Both

Client API of the Olingo4 component to call 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:

olingo4:DEFAULT/methodName?[parameters]

The 9 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

action

Calls an OData action with HTTP POST and returns the entity of the response

batch

Sends several requests in one OData batch request and returns one response per request

create

Creates an OData entity with HTTP POST to its entity set and returns the entity that the service created

delete

Deletes an OData entity with HTTP DELETE, with the ETag of the entity in an If-Match header when it has one, and returns the HTTP status code of the response

merge

Updates the given properties of an OData entity with the HTTP MERGE method, with the ETag of the entity in an If-Match header when it has one

patch

Updates the given properties of an OData entity with HTTP PATCH, with the ETag of the entity in an If-Match header when it has one

read

Reads an OData resource, such as an entity set, an entity, a property, $count or $metadata, and returns it as an Olingo client object

update

Replaces an OData entity with HTTP PUT, with the ETag of the entity in an If-Match header when it has one

uread

Reads an OData resource and returns the response body unparsed, as an InputStream

Method action

Signatures:

  • void action(org.apache.olingo.commons.api.edm.Edm edm, String resourcePath, java.util.Map<String, String> endpointHttpHeaders, Object data, org.apache.camel.component.olingo4.api.Olingo4ResponseHandler responseHandler);

The olingo4/action API method has the parameters listed in the table below:

Parameter Description Type

data

The parameters of the action, as an Olingo ClientEntity or as a JSON String, which is sent as application/json. When it is null, the request has an empty body.

Object

edm

The Edm (entity data model) of the service. The component sets it: it reads $metadata of the service once and uses it for every call, so a value given here is replaced.

Edm

endpointHttpHeaders

HTTP headers to add to this request. They replace the headers of the same name from the httpHeaders option and those that the component sets, such as Accept.

Map

resourcePath

The resource path of the action, relative to the serviceUri

String

responseHandler

The callback that receives the entity of the response, or the HTTP status code when it has no content. The producer and the consumer set it, so a value given here is replaced.

Olingo4ResponseHandler

Method batch

Signatures:

  • void batch(org.apache.olingo.commons.api.edm.Edm edm, java.util.Map<String, String> endpointHttpHeaders, Object data, org.apache.camel.component.olingo4.api.Olingo4ResponseHandler<java.util.List<org.apache.camel.component.olingo4.api.batch.Olingo4BatchResponse>> responseHandler);

The olingo4/batch API method has the parameters listed in the table below:

Parameter Description Type

data

The requests to send, in this order, as a List of Olingo4BatchRequest: Olingo4BatchQueryRequest to read and Olingo4BatchChangeRequest to create, update, patch, merge or delete.

Object

edm

The Edm (entity data model) of the service. The component sets it: it reads $metadata of the service once and uses it for every call, so a value given here is replaced.

Edm

endpointHttpHeaders

HTTP headers to add to this request. They replace the headers of the same name from the httpHeaders option and those that the component sets, such as Accept.

Map

responseHandler

The callback that receives the list of Olingo4BatchResponse. The producer and the consumer set it, so a value given here is replaced.

Olingo4ResponseHandler

Method create

Signatures:

  • void create(org.apache.olingo.commons.api.edm.Edm edm, String resourcePath, java.util.Map<String, String> endpointHttpHeaders, Object data, org.apache.camel.component.olingo4.api.Olingo4ResponseHandler responseHandler);

The olingo4/create API method has the parameters listed in the table below:

Parameter Description Type

data

The entity to create, as an Olingo ClientEntity or as a JSON String, which is sent as application/json.

Object

edm

The Edm (entity data model) of the service. The component sets it: it reads $metadata of the service once and uses it for every call, so a value given here is replaced.

Edm

endpointHttpHeaders

HTTP headers to add to this request. They replace the headers of the same name from the httpHeaders option and those that the component sets, such as Accept.

Map

resourcePath

The resource path of the entity set to create the entity in, for example People

String

responseHandler

The callback that receives the created entity, or the HTTP status code when the response has no content. The producer and the consumer set it, so a value given here is replaced.

Olingo4ResponseHandler

Method delete

Signatures:

  • void delete(String resourcePath, java.util.Map<String, String> endpointHttpHeaders, org.apache.camel.component.olingo4.api.Olingo4ResponseHandler<org.apache.olingo.commons.api.http.HttpStatusCode> responseHandler);

The olingo4/delete API method has the parameters listed in the table below:

Parameter Description Type

endpointHttpHeaders

HTTP headers to add to this request. They replace the headers of the same name from the httpHeaders option and those that the component sets, such as Accept.

Map

resourcePath

The resource path of the entity to delete, with its key, for example People('russellwhyte'). When keyPredicate is set, it is appended in parentheses.

String

responseHandler

The callback that receives the HTTP status code. The producer and the consumer set it, so a value given here is replaced.

Olingo4ResponseHandler

Method merge

Signatures:

  • void merge(org.apache.olingo.commons.api.edm.Edm edm, String resourcePath, java.util.Map<String, String> endpointHttpHeaders, Object data, org.apache.camel.component.olingo4.api.Olingo4ResponseHandler responseHandler);

The olingo4/merge API method has the parameters listed in the table below:

Parameter Description Type

data

The properties to change, as an Olingo ClientEntity or as a JSON String, which is sent as application/json.

Object

edm

The Edm (entity data model) of the service. The component sets it: it reads $metadata of the service once and uses it for every call, so a value given here is replaced.

Edm

endpointHttpHeaders

HTTP headers to add to this request. They replace the headers of the same name from the httpHeaders option and those that the component sets, such as Accept.

Map

resourcePath

The resource path of the entity to update, with its key, for example People('russellwhyte'). When keyPredicate is set, it is appended in parentheses.

String

responseHandler

The callback that receives the entity of the response, or the HTTP status code when it has no content. The producer and the consumer set it, so a value given here is replaced.

Olingo4ResponseHandler

Method patch

Signatures:

  • void patch(org.apache.olingo.commons.api.edm.Edm edm, String resourcePath, java.util.Map<String, String> endpointHttpHeaders, Object data, org.apache.camel.component.olingo4.api.Olingo4ResponseHandler responseHandler);

The olingo4/patch API method has the parameters listed in the table below:

Parameter Description Type

data

The properties to change, as an Olingo ClientEntity or as a JSON String, which is sent as application/json.

Object

edm

The Edm (entity data model) of the service. The component sets it: it reads $metadata of the service once and uses it for every call, so a value given here is replaced.

Edm

endpointHttpHeaders

HTTP headers to add to this request. They replace the headers of the same name from the httpHeaders option and those that the component sets, such as Accept.

Map

resourcePath

The resource path of the entity to update, with its key, for example People('russellwhyte'). When keyPredicate is set, it is appended in parentheses.

String

responseHandler

The callback that receives the entity of the response, or the HTTP status code when it has no content. The producer and the consumer set it, so a value given here is replaced.

Olingo4ResponseHandler

Method read

Signatures:

  • void read(org.apache.olingo.commons.api.edm.Edm edm, String resourcePath, java.util.Map<String, String> queryParams, java.util.Map<String, String> endpointHttpHeaders, org.apache.camel.component.olingo4.api.Olingo4ResponseHandler responseHandler);

The olingo4/read API method has the parameters listed in the table below:

Parameter Description Type

edm

The Edm (entity data model) of the service. The component sets it: it reads $metadata of the service once and uses it for every call, so a value given here is replaced.

Edm

endpointHttpHeaders

HTTP headers to add to this request. They replace the headers of the same name from the httpHeaders option and those that the component sets, such as Accept.

Map

queryParams

The OData query options to add to the request URL, such as $filter, $top or $expand. Endpoint options and CamelOlingo4.* headers that are not options of the component are added to them as well.

Map

resourcePath

The OData resource path, relative to the serviceUri, for example People or People('russellwhyte')/Trips. When keyPredicate is set, it is appended in parentheses.

String

responseHandler

The callback that receives the result. The producer and the consumer set it, so a value given here is replaced.

Olingo4ResponseHandler

Method update

Signatures:

  • void update(org.apache.olingo.commons.api.edm.Edm edm, String resourcePath, java.util.Map<String, String> endpointHttpHeaders, Object data, org.apache.camel.component.olingo4.api.Olingo4ResponseHandler responseHandler);

The olingo4/update API method has the parameters listed in the table below:

Parameter Description Type

data

The new content of the entity, as an Olingo ClientEntity or as a JSON String, which is sent as application/json.

Object

edm

The Edm (entity data model) of the service. The component sets it: it reads $metadata of the service once and uses it for every call, so a value given here is replaced.

Edm

endpointHttpHeaders

HTTP headers to add to this request. They replace the headers of the same name from the httpHeaders option and those that the component sets, such as Accept.

Map

resourcePath

The resource path of the entity to replace, with its key, for example People('russellwhyte'). When keyPredicate is set, it is appended in parentheses.

String

responseHandler

The callback that receives the entity of the response, or the HTTP status code when it has no content. The producer and the consumer set it, so a value given here is replaced.

Olingo4ResponseHandler

Method uread

Signatures:

  • void uread(org.apache.olingo.commons.api.edm.Edm edm, String resourcePath, java.util.Map<String, String> queryParams, java.util.Map<String, String> endpointHttpHeaders, org.apache.camel.component.olingo4.api.Olingo4ResponseHandler<java.io.InputStream> responseHandler);

The olingo4/uread API method has the parameters listed in the table below:

Parameter Description Type

edm

The Edm (entity data model) of the service. The component sets it: it reads $metadata of the service once and uses it for every call, so a value given here is replaced.

Edm

endpointHttpHeaders

HTTP headers to add to this request. They replace the headers of the same name from the httpHeaders option and those that the component sets, such as Accept.

Map

queryParams

The OData query options to add to the request URL, such as $filter, $top or $expand. Endpoint options and CamelOlingo4.* headers that are not options of the component are added to them as well.

Map

resourcePath

The OData resource path, relative to the serviceUri, for example People or People('russellwhyte')/Trips. When keyPredicate is set, it is appended in parentheses.

String

responseHandler

The callback that receives the response body. The producer and the consumer set it, so a value given here is replaced.

Olingo4ResponseHandler

In addition to the parameters above, the olingo4 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 CamelOlingo4.parameter. The inBody parameter overrides message header, i.e., the endpoint parameter inBody=myParameterNameHere would override a CamelOlingo4.myParameterNameHere header.

Message Headers

The Olingo4 component supports the following message header(s), which is/are listed below:

Name Description Default Type

CamelOlingo4.responseHttpHeaders (producer)

Constant: FULL_RESPONSE_HTTP_HEADERS

The HTTP headers of the response, as a Map with one value per header name (the last one when a header occurs more than once).

Map

Message Body

The message body at each side of the Olingo4 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

pojo or value

The result of read for the resourcePath, as in the producer: an entity set is split into one message per ClientEntity and a collection property into one message per ClientValue; with splitResult=false the ClientEntitySet or the ClientCollectionValue comes in one message. With filterAlreadySeen only the entities or values not read before come. uread gives the response unparsed as a stream.

  • With methodName=uread: stream

Producer input

pojo or text

create, update, patch, merge and action send the body as their data, passed as it is without type conversion: a ClientEntity, or the entity as JSON text, which is sent as application/json. A Map, bytes or a stream fails: convertBodyTo String for JSON in bytes or a stream. An action may have no body, and batch takes a List of Olingo4BatchRequest. read, uread and delete do not use the body.

  • With methodName=read: any

  • With methodName=uread: any

  • With methodName=delete: any

  • With methodName=action: pojo, text or null

  • With methodName=batch: list

Not known when inBody is set.

Producer output

pojo or value

read gives the Olingo client object of the resource: a ClientEntitySet, a ClientEntity, the Edm of $metadata or the ClientServiceDocument; a ClientPrimitiveValue, ClientComplexValue or ClientCollectionValue for a property or $value, and a Long for $count. uread gives the response as a stream. create, update, patch, merge and action give the ClientEntity of the response, or the HttpStatusCode when it has no content, as delete does; batch gives a List of Olingo4BatchResponse. With filterAlreadySeen, a result read before is null, and an entity set or a collection value keeps only the entities or values not read before.

  • With methodName=uread: stream

  • With methodName=delete: value

  • With methodName=batch: list

  • With filterAlreadySeen=true: pojo, value or 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 Camel-prefixed exchange headers in addition to the endpoint options. If the route consumes messages from untrusted producers, strip these internal headers at the trust boundary — for example with removeHeaders("Camel*") — before the message reaches this component, so that a sender cannot override the API call. See the Camel security model for details.

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 CamelOlingo4.endpointHttpHeaders property and the response headers will be returned in a CamelOlingo4.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

org.apache.olingo.commons.api.edm.Edm

Service document

/

org.apache.olingo.client.api.domain.ClientServiceDocument

OData entity set

<entity-set>

org.apache.olingo.client.api.domain.ClientEntitySet

OData entity

<entity-set>(<key-predicate>)

org.apache.olingo.client.api.domain.ClientEntity for Out body (response) org.apache.olingo.client.api.domain.ClientEntity, or the entity as JSON String, for In body (request)

Simple property

<entity-set>(<key-predicate>)/<simple-property>

org.apache.olingo.client.api.domain.ClientPrimitiveValue

Simple property value

<entity-set>(<key-predicate>)/<simple-property>/$value

org.apache.olingo.client.api.domain.ClientPrimitiveValue

Complex property

<entity-set>(<key-predicate>)/<complex-property>

org.apache.olingo.client.api.domain.ClientComplexValue

Count

<resource-uri>/$count

java.lang.Long

Examples

The following route reads top 5 entries from the People entity ordered by ascending FirstName property.

Java-only: uses setHeader with Java constant
from("direct:...")
    .setHeader("CamelOlingo4.$top", constant("5"))
    .to("olingo4://read/People?$orderby=FirstName%20asc");

The following route reads Airports entity using the key property value in incoming id header.

Java-only: uses setHeader with header() expression
from("direct:...")
    .setHeader("CamelOlingo4.keyPredicate", header("id"))
    .to("olingo4://read/Airports");

The following route creates People entity using the ClientEntity in body message.

  • Java

  • XML

  • YAML

from("direct:...")
    .to("olingo4://create/People");
<route>
    <from uri="direct:..."/>
    <to uri="olingo4://create/People"/>
</route>
- route:
    from:
      uri: direct:...
      steps:
        - to:
            uri: olingo4://create/People

The following route calls an odata action using the ClientEntity in the body message. The body message may be null for actions that don’t expect an input.

  • Java

  • XML

  • YAML

from("direct:...")
    .to("olingo4://action/People");
<route>
    <from uri="direct:..."/>
    <to uri="olingo4://action/People"/>
</route>
- route:
    from:
      uri: direct:...
      steps:
        - to:
            uri: olingo4://action/People