Camel Components

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>

URI format

olingo2://endpoint/<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 Olingo2 component supports the following options which are listed below.

Name Description Default Type

configuration (common)

The shared configuration of the endpoints: its options are the defaults of each endpoint of this component.

Olingo2Configuration

connectTimeout (common)

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

contentType (common)

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

entityProviderReadProperties (common)

The Olingo EntityProviderReadProperties used to parse the feeds, entries, properties and function import results in the responses, batch responses included.

EntityProviderReadProperties

entityProviderWriteProperties (common)

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

filterAlreadySeen (common)

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

httpHeaders (common)

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

proxy (common)

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

HttpHost

serviceUri (common)

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

socketTimeout (common)

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

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

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

httpClientBuilder (advanced)

Not used: the component always creates an asynchronous HTTP client, from httpAsyncClientBuilder or from the other HTTP options.

HttpClientBuilder

sslContextParameters (security)

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

useGlobalSslContextParameters (security)

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

apiName (common)

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:

  • DEFAULT

Olingo2ApiName

methodName (common)

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

connectTimeout (common)

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

contentType (common)

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

entityProviderReadProperties (common)

The Olingo EntityProviderReadProperties used to parse the feeds, entries, properties and function import results in the responses, batch responses included.

EntityProviderReadProperties

entityProviderWriteProperties (common)

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

filterAlreadySeen (common)

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

httpHeaders (common)

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

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 Apache HttpHost. Not used when httpAsyncClientBuilder is set.

HttpHost

serviceUri (common)

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

socketTimeout (common)

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

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

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

httpClientBuilder (advanced)

Not used: the component always creates an asynchronous HTTP client, from httpAsyncClientBuilder or from the other HTTP options.

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

DEFAULT

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

batch

Sends a batch request, with its query and change set parts, to the $batch resource of the service

create

Creates an OData resource, such as an entry in an entity set, with HTTP POST

delete

Deletes an OData resource and invokes the callback with the HTTP status code of the response

merge

Updates an OData resource with HTTP MERGE, sending only the properties that are in the data

patch

Updates an OData resource with HTTP PATCH

read

Reads an OData resource and invokes the callback with the parsed result

update

Replaces an OData resource with HTTP PUT

uread

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: RESPONSE_HTTP_HEADERS

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

pojo, map, text or value

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.

  • With methodName=uread: stream

  • With splitResult=false: pojo, map, list, text or value

Producer input

map, list, text or value

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.

  • With methodName=read: any

  • With methodName=uread: any

  • With methodName=delete: any

Not known when inBody is set.

Producer output

pojo, map, list, text or value

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.

  • With methodName=uread: stream

  • With methodName=delete: value

  • With methodName=batch: list

  • With filterAlreadySeen=true: pojo, map, list, text, 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 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

org.apache.olingo.odata2.api.edm.Edm

Service document

/

org.apache.olingo.odata2.api.servicedocument.ServiceDocument

OData feed

<entity-set>

org.apache.olingo.odata2.api.ep.feed.ODataFeed

OData entry

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

org.apache.olingo.odata2.api.ep.entry.ODataEntry for Out body (response) java.util.Map<String, Object> for In body (request)

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 java.util.Map<String, Object> with key property names and values for request

Zero or many association links

<entity-set>(<key-predicate>/$link/<one-to-many-entity-set-property>

java.util.List<String> for response java.util.List<java.util.Map<String, Object>> containing a list of key property names and values for request

Count

<resource-uri>/$count

java.lang.Long

Examples

The following route reads top 5 entries from the Manufacturer feed ordered by ascending Name property.

Java-only: uses setHeader with Java constant
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.

Java-only: uses setHeader with header() expression
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&amp;timeUnit=SECONDS&amp;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