Adapter properties and commands

This section provides the detailed description of the adapter properties for defining connections, actions, and cards.

Host

Specifies the host name or TCP/IP address of the Redis server. This is a mandatory property. The corresponding adapter command is -H name (or -HOST name).

Port

Specifies the Redis sever port. The default value is 6379. The corresponding adapter command is -P number (or -PORT number).

Password

Specifies the password for connection to the server if required. The corresponding adapter command is  -PWD password (or -PASSWORD password).

Database ID

Specifies the ID of the database to connect to, if required by the Redis server. The corresponding adapter command is -DID id (or -DATABASE id).

Enable SSL

User can enable this property if the server requires an SSL/TLS connection. The corresponding adapter command is -S (or -SSL).

Certificate Authority Key File

Specifies the file containing the authority key certificate, if used. The corresponding adapter command is -CAF filename (or -CAFILE filename).

Private Key File

Specifies the location of the private key file to use when mutual TLS is enabled. The corresponding adapter command is -KF filepath (or -KEYFILE filepath).

Public Key Certificate File

Specifies the file containing the public key certificate when mutual TLS is enabled. The corresponding adapter command is -KF filepath (or -CERTFILE filepath).

Server Name Indicator

Specifies the DNS hostname for server name indication. The corresponding adapter command is -SNI.

Verify Hostname

Instructs the adapter to verify the hostname value in the server certificate presented by the Redis server during the SSL/TLS handshake. The corresponding adapter command is -V (or -VERIFY).

Command

Specifies the command to execute. The corresponding adapter command is -C command (or -CMD command).

Key

Specifies the Redis key. This is required for all commands except SUBSCRIBE, PSUBSCRIBE, and PUBLISH. The corresponding adapter command is -K key (or -KEY key).

Channel

Specifies the name of the channel for pub/sub operations. The corresponding adapter command is -CH name (or -CHANNEL name).

Data

Specifies the data. The corresponding adapter command is -D data (or -DATA data).

When providing data to the adapter, it can be passed to the input terminals of a target or request node, or to the output card of a map. Alternatively, it can be passed via the Data property. This is convenient if calling a command that requires request data, such as HMGET or sorted set commands. For more information, see the Data Formats section.
JSON

If this option is enabled, the data sent to, or received from Redis is sent as JSON data. The corresponding adapter command is -J (or -JSON).

Options

Specifies the options to modify the behavior of certain commands. Multiple options should be separated with a | character. The corresponding adapter command is -O (or -OPTIONS).

The supported options are as follows:
Command Option Description
SET EX=expiration Expiration time in seconds.
SET NX Set if the key does not already exist.
ZADD XX Only update elements that already exist.
ZADD NX Only add new elements.
ZRANGE BYSCORE Start and stop are scores rather than index.
ZRANGE REV Reverse the order of the results.
ZRANGE WITHSCORES Return the scores with the elements.
ZRANK WITHSCORES Return the score with the rank.
ZREVRANGE WITHSCORES Return the score with the rank.
Charset

Specifies the character set of the data. Default value is UTF-8.

The character set of any string data. This is used when converting from strings to bytes to send to Redis, or when creating a string from bytes in Redis. If not specified, the default system encoding is used. The corresponding adapter command is -CS charset (or -CHARSET charset).

Timeout

The blocking time in seconds for BLPOP, BRPOP, SUBSCRIBE, and PSUBSCRIBE operations. If set to 0, the operation will block until an object is available. The corresponding adapter command is -TO timeout (or -TIMEOUT timeout).

Logging

This property specifies the level of logging to use for the log (trace) file produced by the adapter. The default is Off. The value Information means log informational, the value Errors Only means log error messages only, and the value Verbose means log debug and trace level messages along with the informational and error messages.

The corresponding adapter command is:

-T [E|V] [+] [file_path]

-T -> Log adapter informational messages.

-TE -> Log only adapter errors.

-TV -> Use verbose (debug) logging. The log file records all activity that occurs while the adapter is producing or consuming messages.

+ -> Appends the trace information to the existing log file. Omit this argument to create a new log file.

file_path -> The m4redis.mtr log file in the map directory.

Data Formats
For primitive operations, the data is passed as strings with no formatting. Data passed to operations is sent in database-delimited format (| delimiter, \n terminator, ! release). If the JSON option is enabled, then data is instead passed and returned as JSON objects/arrays. This table lists what is required for inputs and outputs for each command. For input data, lists should be specified terminating each entry with \n terminator. If multiple values are required, delimit the values with | or \n characters.
Command In Out JSON
GET - Bytes -
SET Bytes - -
APPEND Bytes - -
DEL - - -
EXISTS - true or false -
INCR - Integer -
INCRBY Integer Integer -
DECR - Integer -
DECRBY Integer Integer -
LPOP - Bytes -
RPOP - Bytes -
BLPOP - Bytes -
BRPOP - Bytes -
LPUSH Bytes - -
RPUSH Bytes - -
SADD Bytes - -
SMEMBERS - List of members Out
HSET List of field/values - In
HSETNX List of field/values - In
HGET Key Value -
HMGET List of fields In/Out
HMGETALL - List of field/values Out
HEXISTS Key true or false -
HDEL Key -
HKEYS - List of Keys Out
HINCRBY Field/Integer Integer In
ZADD List of member/scores - In
ZCARD - Integer -
ZCOUNT Min/Max Integer In
ZRANGE Start/Stop List of members In/Out
ZRANGE with scores Start/Stop List of member/scores In/Out
ZREM List of members - In
ZRANK Member Integer
ZRANK with score Member Rank/Score Out
ZREVRANK Member Integer -
ZREVRANK with score Member Rank/Score Out
ZSCORE Member Score -
PUBLISH Bytes - -
SUBSCRIBE - Bytes -
P SUBSCRIBE - Bytes -
Schemas can be generated from the Map Designer when the Redis adapter is used in an input or output card. It generates the appropriate schema based on:
  • Whether the adapter is used in an input or output card.

  • The selected command.

  • Whether the JSON option is enabled.