Synadia Connect

Transformers

Synadia Connect supports Mapping and Service transformers for modifying messages as they flow through a connector.


Mapping Transformer

The mapping transformer uses Bloblang, a powerful declarative language for data transformation.

Configuration

NameTypeOptionalSecretDescription
sourcecodestringnonoBloblang mapping code that transforms messages.

Examples

Add fields to a message:

mapping:
  sourcecode: |
    root = this
    root.id = uuid_v4()
    root.processed_at = timestamp_unix()

Restructure a message:

mapping:
  sourcecode: |
    root = this
    root.user = {
      "name": this.firstName + " " + this.lastName,
      "email": this.email.lowercase()
    }
    root.metadata = {
      "source": "connector",
      "version": 1
    }

Handle missing values:

mapping:
  sourcecode: |
    root = this
    root.name = this.name.or("Anonymous")
    root.score = this.score.catch(0)

Delete sensitive fields:

mapping:
  sourcecode: |
    root = this
    root.password = deleted()
    root.ssn = deleted()

See the Bloblang Reference for the complete language documentation.


Service Transformer

The service transformer sends each message to a NATS service and uses the response as the transformed message.

Configuration

NameTypeOptionalSecretDescription
endpointstringnonoThe NATS subject where the service receives requests.
timeoutstringyesnoMaximum time to wait for a response. The value defaults to 5s.

Example

service:
  endpoint: 'transform.enrich-user'
  timeout: '10s'
Previous
Remove a connector