Conversion by Properties (Deprecated)
Conversion by Properties is a deprecated configuration form of inboundTransformationStrategy.
It sets properties directly on the strategy, and the conversion depends on those properties and the incoming payload type.
Use Conversion by Format for new integration flows.
See Payload Types for the payload representations.
You can’t mix conversion by properties and conversion by format in the same strategy. A strategy that mixes the two formats fails when the flow spec is built.
Set objectConversionFormat to a format such as MarshallingFormat.JSON and characterSet to a character encoding:
inboundTransformationStrategy {
objectConversionFormat = <marshalling format>
characterSet = <character encoding>
}
Refer to Oracle’s Internationalization Guide for a list of supported characterSet encodings.
|
The following example configures a map processor that receives JSON text with a results property:
map {
id = "format-response"
mapSpec = """
{
"message" : #input.payload.results[[1]]
}
""".trimIndent()
inboundTransformationStrategy {
objectConversionFormat = MarshallingFormat.JSON
}
}
If you set both objectConversionFormat and characterSet, the same property-based strategy can convert in either direction.
For binary input, it produces an object; for object input, it produces a string.
A Conversion by Format strategy converts in one direction, so there is no single replacement.
Replace such a strategy with fromJsonText() or fromXmlText() where the payload arrives as binary or a string.
Use fromJsonCompliant() where it arrives as an object.
The following table shows the properties for each conversion and the Conversion by Format strategy that replaces them:
| From | To | Conversion by properties | Conversion by format |
|---|---|---|---|
String |
Object |
|
|
String |
XML compliant object |
|
|
Binary XML |
XML compliant object |
|
|
String or binary XML, with a schema and namespace prefixes |
XML compliant object |
|
|
String or binary XML, with a doctype declaration |
XML compliant object |
|
|
Binary |
Object |
|
|
Binary |
String |
|
|
String |
Binary |
|
|
Object |
String |
|
|
XML compliant object |
XML String |
|
|
XML compliant object |
XML String, for sending as ISO-8859-1 bytes |
|
|
Object or list |
Avro binary (single record) |
|
|
List |
Avro binary (multiple records) |
|
|
Avro binary (single record) |
Object or list |
|
|
Avro binary (multiple records) |
List |
|
|
schemaId identifies a resource in the Resource Registry.
|
| An incoming payload that does not fit the conversion format fails the message. |
Conversion by Properties encodes an object’s XML using characterSet, but always encodes its JSON using UTF-8.
The processor decodes those bytes using characterSet to obtain a string.
If characterSet is not UTF-8, non-ASCII characters in JSON text are corrupted.
For XML, characters that characterSet cannot represent are lost.
The XML declaration takes its encoding from the object’s _declaration property, not from characterSet.
It can therefore name a different encoding from the one the conversion uses for the XML text.
See XML-compliant for _declaration.
With Conversion by Format, toJsonText and toXmlText give the processor a string that keeps every character.
toXmlText { characterSet = … } also sets the XML declaration’s encoding to that character set.
MarshallingFormat.AVRO_RECORDS converts like fromAvroRecords and toAvroRecords, and MarshallingFormat.AVRO_SINGLE_RECORD like fromAvroSingleRecord and toAvroSingleRecord.
Avro Conversion describes both.
Transformation Properties
To configure how the conversion writes an object as text, set transformerProperties:
inboundTransformationStrategy {
characterSet = "UTF-8"
transformerProperties = """
propertyOne=true
propertyTwo=true
""".trimIndent()
}
The following properties are available:
| Transformer Property | Description | Conversion by format |
|---|---|---|
|
If |
|
|
If |
|