MessageTranslator
Overview
How can systems using different data formats communicate with each other using messaging?
Use a special filter, a Message Translator, between other filters or applications to translate one data format into another.
https://www.enterpriseintegrationpatterns.com/patterns/messaging/MessageTranslator.html
Examples
Output all known data
Config
name: message-translator
nodes:
- id: start
operator: HTTPIn
method: ^(GET)$
routes:
- /message-translator/{id}
- id: translate
operator: MessageTranslator
mode: json
template: |
{
"data": data,
"settings": settings,
"input": input,
"temp": temp
}
edges:
- { from: start, to: translate }Request
curl -v http://localhost:2243/message-translator/123?filter=nameResponse
{
"data": {
},
"input": {
"resource": "message-translator.translate(MessageTranslator)"
},
"settings": {
},
"temp": {
"http_in": {
"cookies": {
"_ga": "GA1.1.1677025424.1746073395",
},
"method": "GET",
"params": {
"id": "123"
},
"path": "/message-translator/123",
"query": {
"filter": "name"
},
"query_string": "filter=name"
}
}
}Configuration Reference
name
Must be 'MessageTranslator'
Stringrequiredengine
What implementation is used.
cel-interpreteroptionalDefault: "cel-interpreter"in_temp
Indicates if the output should be stored in temp space or passed as a message to the next node.
BooleanoptionalDefault: "false"temp_group
If `in_temp` is true, then where in the temp space the output is stored.
Stringoptionalmode
Indicates how the template should be parsed by the engine.
expression|jsonoptionalDefault: "json"template
The template that needs to be evaluated.
Stringrequired