Skip to main content

The bin-transforms section of aerospike-pubsub-outbound.yml

Bins in Aerospike records correspond to the names of attributes in messages generated by the connector. For cases where the name of a bin does not match the name of the corresponding attribute, you can use the bin-transforms section of the /etc/aerospike-pubsub-outbound/aerospike-pubsub-outbound.yml YAML file to configure the transformations to apply on the names of bins.

The transforms can be specified as a mapping or a series of transforms to apply on the bin names. In case a bin name is specified in the mapping section then the transforms are not applied on the matched bin.

Map

The map option lets you specify the name of one or more bins and the name of their corresponding attributes in published messages. For example, suppose that your Aerospike records contained these bins and messages include these attributes:

Binsattributes
lastnamelast_name
firstnamefirst_name
mobilemobile_phone

The entries for the map option in the bin-transforms section of your configuration file would look like this:

bin-transforms:
map:
lastname: last_name
firstname: first_name
mobile: mobile_phone

Transforms

If your Aerospike records include bins whose names do not match attribute names and that are not listed as entries for the map option, then you must use the transforms option to specify how to map bin names to attribute names.

The following transforms are supported:

  • lowercase Converts to lowercase.
  • uppercase Converts to uppercase
  • trim Trims leading and trailing whitespace.
  • regex Matches against a regex pattern and replaces all occurrences with a replacement. The regex and replacement use Java regex syntax.

Example

This example shows a mapping of the bin name red-color to the attribute name red. It also shows transforms to apply to all other bin names.

bin-transforms:
map:
red-color: red
transforms:
- regex:
pattern: '-'
replacement: '_'
- uppercase

If an Aerospike record includes the bins red-color and blue-color, the corresponding attributes in the published message will have the names red and BLUE_COLOR, as shown in the table below:

Aerospike Bin NameTransformed name
red-colorred
blue-colorBLUE_COLOR