org.mule.modules

mule-module-odata

config

Namespacehttp://www.mulesoft.org/schema/mule/odata
Schema Locationhttp://www.mulesoft.org/schema/mule/odata/current/mule-odata.xsd  (View Schema)
Schema Version1.0
Minimum Mule Version3.4

Module Overview

Connector for consuming OData feeds by performing read, create, update and delete operations. Bath operations are also supported. This version of the connector does not use any kind of authentication.

Summary

Configuration
<odata:config>
Configure an instance of this module
Message Processors
<odata:batch>
Executes a series of insert/update/deletes in a batch grouped in one changeset.
<odata:create-entity>
Inserts an entity from an input pojo.
<odata:delete-entity>
Deletes an entity represented by a pojo on the OData service To specify the entitie's id, your pojo can rather have an attribute of type Guid or to have a string attribute annotated with Guid
<odata:get-entities>
Reads entities from an specified set and returns it as a list of pojos.
<odata:update-entity>
Updates an entity represented by a pojo on the OData service To specify the entitie's id, your pojo can rather have an attribute of type Guid or to have a string attribute annotated with Guid

Configuration

To use the this module within a flow the namespace to the module must be included. The resulting flow will look similar to the following:

<mule xmlns="http://www.mulesoft.org/schema/mule/core"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xmlns:odata="http://www.mulesoft.org/schema/mule/odata"
      xsi:schemaLocation="
               http://www.mulesoft.org/schema/mule/core
               http://www.mulesoft.org/schema/mule/core/current/mule.xsd
               http://www.mulesoft.org/schema/mule/odata
               http://www.mulesoft.org/schema/mule/odata/current/mule-odata.xsd">

      <!-- here goes your flows and configuration elements -->

</mule>

This module is configured using the config element. This element must be placed outside of your flows and at the root of your Mule application. You can create as many configurations as you deem necessary as long as each carries its own name.

Each message processor, message source or transformer carries a config-ref attribute that allows the invoker to specify which configuration to use.

Attributes
TypeNameDefault ValueDescriptionJava TypeMIME TypeEncoding
xs:string name Optional. Give a name to this configuration so it can be later referenced.
consumerFactory Optional. An instance of ODataConsumerFactory to intanciate the ODataConsumer.
consumerVersion V2 Optional. The protocol version to be used when consuming external services
formatType JSON Optional. The format of the payload to be used during communication.
namingFormat LOWER_CAMEL_CASE Optional. The namig policy to be used when mapping pojo's attributes to OData entities.

Connection Pool

This connector offers automatic connection management via the use of a connection pool. The pool will act a storage mechanism for all the connections that are in-use by the user of this connector.

Prior to execution of a processor, the connector will attempt to lookup an already established connection and if one doesn't exists it will create one. That lookup mechanism is done in the connection pool via the use of connection variables declared as keys.

The user of the connector can configure the pool by adding a connection-pooling-profile to the connector configuration like this:

    <odata:connection-pooling-profile maxActive="10" maxIdle="10"
                             exhaustedAction="WHEN_EXHAUSTED_GROW" maxWait="120" minEvictionMillis="60000" evictionCheckIntervalMillis="30000"/>

The following is a list of connection attributes, each connection attribute can be configured at the config element level or they can also be added to each processor. If they are used at the processor level they get the benefit of full expression resolution.

Connection Attributes
NameDefault ValueDescriptionJava TypeMIME TypeEncoding
config-ref Optional. Specify which configuration to use.
username The authorization username String */* UTF-8
password The authorization password String */* UTF-8
serviceUri The URI of the target OData Service String */* UTF-8

Reconnection Strategies

Reconnection Strategies specify how a connector behaves when its connection fails. You can control how Mule attempts to reconnect by specifying a number of criteria:

With a reconnection strategy, you can better control the behavior of a failed connection, by configuring it, for example, to re-attempt the connection only once every 15 minutes, and to give up after 30 attempts. You can also send an automatic notification to your IT administrator whenever this reconnection strategy goes into effect. You can even define a strategy that attempts to reconnect only during business hours. Such a setting can prove useful if your server is frequently shut down for nightly maintenance.

Configuration

A reconnection strategy that allows the user to configure how many times a reconnection should be attempted and how long to wait between attempts.

    <odata:config>
         <reconnect count="5" frequency="1000"/>
    </odata:config>
Reconnect Attributes
NameDefault ValueDescription
frequency 2000 Optional. How often (in ms) to reconnect
count 2 Optional. How many reconnection attempts to make

For more information about reconnection strategies in Mule, or even how to write your own custom reconnection strategy please check this section.

Message Processors

<odata:batch>

Executes a series of insert/update/deletes in a batch grouped in one changeset.

XML Sample
INCLUDE_ERROR

Attributes
NameDefault ValueDescriptionJava TypeMIME TypeEncoding
config-ref Optional. Specify which configuration to use.
message The current mule message MuleMessage */*
Connection Parameters
This are only required if you didn't specified them at the configuration element. They are also useful for overriding the values of the configurations or even if you need to extract them from the Mule message since they support expression evaluation.
username Optional. The authorization username String */* UTF-8
password Optional. The authorization password String */* UTF-8
serviceUri Optional. The URI of the target OData Service String */* UTF-8
Child Elements
NameDefault ValueDescriptionJava Type
<odata:processors> Nested processors where each individual operation is to be performed List<NestedProcessor>
Returns
Return Type Description
BatchResult an instance of BatchResult

<odata:create-entity>

Inserts an entity from an input pojo. To specify the entitie's id, your pojo can rather have an attribute of type Guid or to have a string attribute annotated with Guid

XML Sample
INCLUDE_ERROR

Attributes
NameDefault ValueDescriptionJava TypeMIME TypeEncoding
config-ref Optional. Specify which configuration to use.
message The current mule message MuleMessage */*
entity #[payload] Optional. An object representing the entity Object */*
entitySetName Optional. The name of the set. If not specified then it's inferred by adding the suffix 'Set' to the objects simple class name String */* UTF-8
Connection Parameters
This are only required if you didn't specified them at the configuration element. They are also useful for overriding the values of the configurations or even if you need to extract them from the Mule message since they support expression evaluation.
username Optional. The authorization username String */* UTF-8
password Optional. The authorization password String */* UTF-8
serviceUri Optional. The URI of the target OData Service String */* UTF-8

<odata:delete-entity>

Deletes an entity represented by a pojo on the OData service To specify the entitie's id, your pojo can rather have an attribute of type Guid or to have a string attribute annotated with Guid

XML Sample
INCLUDE_ERROR

Attributes
NameDefault ValueDescriptionJava TypeMIME TypeEncoding
config-ref Optional. Specify which configuration to use.
message The current mule message MuleMessage */*
entity #[payload] Optional. An object representing the entity Object */*
entitySetName Optional. The name of the set. If not specified then it's inferred by adding the suffix 'Set' to the objects simple class name String */* UTF-8
keyAttribute The name of the pojo's attribute that holds the entity's key. The attribute cannot hold a null value String */* UTF-8
Connection Parameters
This are only required if you didn't specified them at the configuration element. They are also useful for overriding the values of the configurations or even if you need to extract them from the Mule message since they support expression evaluation.
username Optional. The authorization username String */* UTF-8
password Optional. The authorization password String */* UTF-8
serviceUri Optional. The URI of the target OData Service String */* UTF-8

<odata:get-entities>

Reads entities from an specified set and returns it as a list of pojos. You can optionally provide a returnClass parameter which will allow you to get the result as a list of pojos (as long as that class is compliant with the Bean contract). If you don't specify it, you'll get a list of generic ${org.odata4j.core.OEntity} objects.

XML Sample
INCLUDE_ERROR

Attributes
NameDefault ValueDescriptionJava TypeMIME TypeEncoding
config-ref Optional. Specify which configuration to use.
returnClass org.odata4j.core.OEntity Optional. The canonical class name for the pojo instances to be returned. If none especified then generic OEntity class will be returned. OEntity is a pojo which represents the set's metadata and allows for browsing String */* UTF-8
entitySetName The name of the set to be read String */* UTF-8
filter Optional. An OData filtering expression. If not provided, no filtering occurs (see http://www.odata.org/developers/protocols/uri-conventions#FilterSystemQueryOption) String */* UTF-8
orderBy Optional. The ordering expression. If not provided, no ordering occurs (see http://www.odata.org/developers/protocols/uri-conventions#OrderBySystemQueryOption( String */* UTF-8
expand Optional. Sets the expand expressions. String */* UTF-8
skip Optional. Number of items to skip, usefull for pagination. If not provided, no records are skept (see http://www.odata.org/developers/protocols/uri-conventions#SkipSystemQueryOption) Integer */*
top Optional. Number of items to return (see http://www.odata.org/developers/protocols/uri-conventions#TopSystemQueryOption) Integer */*
select Optional. The selection clauses. If not specified, all fields are returned (see http://www.odata.org/developers/protocols/uri-conventions#SelectSystemQueryOption) String */* UTF-8
Connection Parameters
This are only required if you didn't specified them at the configuration element. They are also useful for overriding the values of the configurations or even if you need to extract them from the Mule message since they support expression evaluation.
username Optional. The authorization username String */* UTF-8
password Optional. The authorization password String */* UTF-8
serviceUri Optional. The URI of the target OData Service String */* UTF-8
Returns
Return Type Description
List<Object> a list of objects of class "returnClass" representing the obtained entities

<odata:update-entity>

Updates an entity represented by a pojo on the OData service To specify the entitie's id, your pojo can rather have an attribute of type Guid or to have a string attribute annotated with Guid

XML Sample
INCLUDE_ERROR

Attributes
NameDefault ValueDescriptionJava TypeMIME TypeEncoding
config-ref Optional. Specify which configuration to use.
message The current mule message MuleMessage */*
entity #[payload] Optional. An object representing the entity Object */*
entitySetName Optional. The name of the set. If not specified then it's inferred by adding the suffix 'Set' to the objects simple class name String */* UTF-8
keyAttribute The name of the pojo's attribute that holds the entity's key. The attribute cannot hold a null value String */* UTF-8
Connection Parameters
This are only required if you didn't specified them at the configuration element. They are also useful for overriding the values of the configurations or even if you need to extract them from the Mule message since they support expression evaluation.
username Optional. The authorization username String */* UTF-8
password Optional. The authorization password String */* UTF-8
serviceUri Optional. The URI of the target OData Service String */* UTF-8

Message Sources

Transformers