Skip to main content

"configureTopic" (JSON Action)

JSON MQ "configureTopic" action configures an MQTT topic in FairCom MQ and FairCom Edge

The "configureTopic" action configures an existing MQTT topic or creates a new one. Configuring a topic is similar to altering a topic except the FairCom server automatically creates a topic when you specify a non-existent topic name.

Note

If a topic already exists, you must use "alterIntegrationTable" to change the retention settings: "retentionPolicy", "retentionPeriod", and "retentionUnit".

  • You may send a "configureTopic" message repeatedly to update as few or many properties as desired. When you omit a property, its current value remains unchanged. Each time you send this message is sent, it modifies the topic’s settings.

  • If the topic has already been published to FairCom's servers, "configureTopic" configures it.

  • If the topic has not yet been published to FairCom's servers, "configureTopic" creates and configures it.

  • Creating a topic includes creating an integration table to store the topic’s messages. By default, tables are created in the ctreeSQL database, however, you can reconfigure this to any database you like by changing the configuration or the API session defaults.

  • Each time this message is sent, it modifies the topic’s settings.

  • The MQTT Publication service and the MQTT Subscription service are also preconfigured.

Request examples

Minimal

{
  "api": "mq",
  "apiVersion": "1.0",
  "action": "configureTopic",
  "params": {
    "topic": "test/topic1"
  },
  "authToken": "replaceWithAuthTokenFromCreateSession"
}

Note

This example (which shows all of the available parameters) requires additional support in order to work. MQTT messages that clients publish to this topic ("acmefactory/line1/station1/acidbath/telemetry") will be automatically stored in the table's "source_payload" field when they arrive. 

The broker will then publish an MQTT message to all subscribers of that topic. The contents of that message will come from the table field specified by the "outputPayloadField" parameter. If that parameter had specified the "source_payload" field, subscribing clients would receive the same message that arrived and was stored in the table. However, in this example, the "outputPayloadField" parameter is specifying the "aValidFieldName" field of the table. That means this topic requires a transform that reads the MQTT message payload from the "source_payload" field, performs some type of transformation on that data, and then stores the results in the "aValidFieldName" field (which will then be copied into the payload of the MQTT messages which the broker sends to all of this topic's subscribers). The "transformName" property specifies the transform which will be used - "acidbath_transform_01" in this example. Before this "configureTopic" action is executed, that transform needs to be created using the "createTransform" action.

If you wanted the MQTT messages to be forwarded to the subscribers as received, you could omit the "outputPayloadField" and "transformName" parameters, which would result in those parameters' default values — "source_payload" and null (meaning "no transform") being used.

{
  "api": "mq",
  "apiVersion": "1.0",
  "requestId": "2",
  "action": "configureTopic",
  "params": {
    "topic": "acmefactory/line1/station1/acidbath/telemetry",
    "ownerName": "admin",
    "databaseName": "faircom",
    "tableName": "acmefactory_line1_station1_acidbath_telemetry",
    "rebuildTable": "false",
    "threads": 1,
    "sourcePayloadFormat": "binary",
    "retentionPolicy": "autoPurge",
    "retentionPeriod": 30,
    "retentionUnit": "day",
    "maxInflightMessages": 20,
    "maxDeliveryRatePerSecond": 0,
    "retrySeconds": 5,
    "downgradeQoS": false,
    "newSubscriberDeliveryMode": "newMessages",
    "newSubscriberMaxDeliveredMessages": 3,
    "outputPayloadField": "aValidFieldName",
    "operationIntent": "upsert",
    "metadata": {},
    "forwardToTopics": [],
    "subscribeToExternalBroker": "false",
    "transformName": null,
    "forwardToExternalBrokers": [],
    "label": {
      "group": "group name",
      "name": "label name"
    }
  },
  "authToken": "replaceWithAuthTokenFromCreateSession"
}
{
  "result": {},
  "errorCode": 0,
  "errorMessage": "",
  "authToken": "replaceWithAuthTokenFromCreateSession"
}
{
  "result": {},
  "requestId": "2",
  "errorCode": 0,
  "errorMessage": "",
  "authToken": "replaceWithAuthTokenFromCreateSession"
}

The "configureTopic" JSON action manages MQTT topics in FairCom MQ and FairCom Edge, allowing for both creating new and altering existing topics, repeatedly updating topic properties, automatically creating topics upon publishing, creating integration tables for message storage, and pre-configurating MQTT Publication and Subscription services. Parameters include database name, QoS downgrading, external broker forwarding, message labeling, delivery rates, metadata, retention policies, data formats, and table management, offering extensive control over topic behavior and data handling.

API actionsJSON MQ APIJSON Actionconfigure topicconfigureTopicfaircom MQFairCom EdgeMQTT topicJSON MQMQTT configurationtopic creationtopic alterationcreate topicalter topictopic configurationforward to topics

The "params" property is an object that contains an action's parameters. Each action defines its own required and optional properties. See System limits for a comprehensive look at property requirements and limitations.

Table 1. configureTopic "params" properties summary

Property

Description

Default

Type

Limits (inclusive)

databaseName

(optional) specifies the name of a database

Defaults to the "defaultDatabaseName" value that is set during "createSession". If no default is set during "createSession", then "faircom" is used.

string

1 to 64 bytes

downgradeQoS

(optional) controls how FairCom Edge manages the Quality of Service (QoS) of subscriptions to this topic

false

Boolean

true
false

forwardToExternalBrokers

(optional) forwards all messages sent to this topic to each external broker using the specified topic name

[]

array of objects

Zero or more objects

forwardToExternalBrokers
.brokerConnectionName

(optional) specifies a user-defined name of a connection that allows messages to be forwarded to an external broker

""

string

forwardToExternalBrokers
.forwardQos

(optional) specifies which quality of service (QoS) to use when forwarding messages to the external broker for the persisted topic

1

integer

0
1
2
forwardToExternalBrokers
.topic

(optional) specifies the MQTT topic on the external broker to which messages will be forwarded

""

string

1 to 65,500 bytes

forwardToTopics

(optional) forwards all messages sent to this topic to each of the topics in the array

[]

array of strings

One or more strings

label

(optional) assigns a label to the object using the label's group and name.

null

object

"label": {
  "group": "group name",
  "name": "label name"
}
label
.group

(optional) identifies a label using its group description.

""

string

0 to 64 bytes

label
.name

(optional) identifies a label using its name.

""

string

0 to 64 bytes

labelID

(optional) assigns a label to the object using the label's ID.

null

integer

0 to 4294967296

maxDeliveryRatePerSecond

(optional) specifies the throttle rate for current and new subscribers of the topic

0

int32

0 to 2147483647

maxInflightMessages

(optional) protects subscribers from receiving messages faster than they can handle

0

int32

0 to 2147483647

metadata

(optional) exists primarily for the user interface to find integration information

{}

object

May contain any number and type of user-defined properties

newSubscriberDeliveryMode

(optional) specifies how new subscribers receive messages

"newMessages"

string

"newMessages"
"storedMessages"

newSubscriberMaxDeliveredMessages

(optional) specifies the maximum number of previously stored historical messages that a client receives when it subscribes to the topic

-1

integer or "all"

-1 to 2147483647 or "all"

operationIntent

(optional) specifies the intent of the operation

"upsert"

string

"upsert"
"insert"
"update"

outputPayloadField

(optional) specifies the field that the MQTT Subscription service should use as the payload when it sends the payload to subscribers

"source_payload"

string

"source_payload"
A user-defined field

ownerName

(optional) specifies the unique name of a schema in a database

""

string

rebuildTable

(optional) rebuilds the table when set to true.

WARNING: Rebuilding a table interrupts data collection until the table is rebuilt.

false

Boolean

true
false

retentionPeriod

(optional) specifies the number of retention units, which controls how long data is retained – see "retentionUnit"

30

integer

1 to 100

retentionPolicy

(optional) specifies how messages persist

"autoPurge"

string

"autoPurge"
"neverPurge"

retentionUnit

(optional) purges expired messages each time this unit cycles – see "retentionPeriod"

"day"

string

"minute"
"hour"
"day"
"week"
"month"
"year"

retrySeconds

(optional) specifies the number of seconds to wait for the next expected packet during a PUBLISH packet exchange with a client

5

integer

1 to 65535

sourcePayloadFormat

(optional) specifies the variant type format of the "source_payload" field

"binary"

string

"json"
"xml"
"binary"
"jpeg"
"siemensUdt"
"utf8"

subscribeToExternalBroker

(optional) connects to the external MQTT broker and subscribes to this topic on that broker

""

string

Any previously defined name of a broker connection (see "configureBrokerConnection")

tableName

(optional) specifies the name of a table

""

string

1 to 64 bytes

threads

(optional) specifies the number of threads assigned to a topic to write published messages to disk

1

integer

1
2
3

topic

specifies a unique user-defined name for the topic

Required - No default value

string

1 to 65,500 bytes

transformName

(optional) specifies the name of a transform process you have created. See the "createTransform" and "alterTransform" actions

""

string

1 to 64 bytes



The "databaseName" property is an optional string that specifies the database that contains the tables. It defaults to the database name supplied at login.

Note

In the API Explorer, "defaultDatabaseName" is set to "ctreeSQL" in the "createSession" action that happens at login.

  • A zero-length "databaseName" is invalid.

  • Its limits are from 0 to 64 bytes.

  • If the "databaseName" property is omitted or set to null, the server will use the default database name specified at login.

  • If no default database is specified during "createSession", "defaultDatabaseName" will be set to the "defaultDatabaseName" value that is specified in the services.json file.

The "downgradeQoS" property controls how FairCom's servers manage the Quality of Service (QoS) of subscriptions to this topic. This property is optional. The default value is false.

  • When false, FairCom's servers honor the QoS requested by each subscriber regardless of the QoS of publishers.

  • When true, FairCom's servers downgrade the QoS of subscribers to match the QoS of the publisher.

The "forwardToExternalBrokers" property is optional.  It can be omitted. It is an array of objects containing one or more brokers to forward the message to.  All messages sent to this topic will be forwarded to each of these external brokers using the specified topic name. The default is an empty object.

  • If there are no items in the list, it is not an error, FairCom's servers simply do not set up any external forwards.  This is also how you can configure an existing topic to STOP forwarding to external brokers.

  • If this broker connection name does not already exist:

    • FairCom's servers do not set up the forward.

    • It logs an error stating, "Cannot forward to the external broker because the connection name xxx has not yet been defined by configureBrokerConnection."

    • A failure does not stop FairCom's servers from trying to set up the next broker in the list.

  • Each time the "configureTopic" message is sent, FairCom's servers will completely replace its existing list for "forwardToExternalBrokers" with the new list.

    Note

    Be careful not to create infinite message loops by forwarding topics to each other.  For example, topic A forwards to topic B and topic B forwards to topic A.  FairCom's servers currently do not detect or shut down infinite message loops.

Example

{ 
  "api": "mq", 
  "action": "configureTopic", 
  "params": 
  {
    "topic": "modbusdata1", 
    "tableName": "modbusTableTCP",
    "forwardToExternalBrokers": 
    [ 
      { 
        "brokerConnectionName": "Broker1", 
        "topic": "modbusdata2",
        "forwardQoS": 1
      } 
    ]
  },
  "authToken": "replaceWithAuthTokenFromCreateSession"
}

The "forwardToTopics" property is an array of Topic Names. This property is optional. FairCom's servers will take all messages sent to this topic and automatically forward them to each of the topics in the array. These messages are forwarded within the same instance. The default is an empty array.

  • If a topic does not already exist, FairCom's servers create it as if an external client sent a message to the topic.

  • Each time the "ConfigureTopic" message is sent, FairCom's servers will completely replace its existing list for "forwardToTopics" with the new list.

  • FairCom's servers will not forward a topic to itself. Thus, if the "forwardToTopics" array contains the topic from "ConfigureTopic", FairCom's servers ignore it.

    Note

    Be careful not to create infinite message loops by forwarding topics to each other.  For example, topic A forwards to topic B and topic B forwards to topic A.  FairCom's servers currently do not detect or shut down infinite message loops.

  • This feature is designed to ease the pain of topic migration, which occurs when clients begin publishing to different topics before subscribers can adjust.

The optional "label" property assigns a label to an object. The "label" object contains "group" and "name" properties that uniquely identify a label. If you omit the "group" and "name" properties, they default to the empty string, "", which is a valid group and name for a label.

A label is a tag that you can add to some objects, such as an MQTT topic or session. You can use list actions such as "listTopics" and "listMqSessions" to find objects with a specific label.

The "label" property is mutually exclusive from the "labelId" property.

Example

"label": {
 "group": "group name",
 "name": "label name"
}

The optional "group" property is a child of the "label" property. It defaults to "", which is a valid group name.

A label's "group" and "name" properties work together to uniquely identify a label. If you omit the "group" and "name" properties, they default to the empty string, "", which is a unique and valid natural identifier for a label.

The "labelId" property is another way to uniquely identify a label.

Example

"label": {
  "group": "group name",
  "name": "label name"
}

The optional "name" property is a child of the "label" property. It defaults to "", which is a valid label name.

A label's "group" and "name" properties work together to uniquely identify a label. If you omit the "group" and "name" properties, they default to the empty string, "", which is a unique and valid natural identifier for a label.

The "labelId" property is another way to uniquely identify a label.

Example

"label": {
  "group": "group name",
  "name": "label name"
}

The optional "labelId" property assigns a label to an object. The "labelId" property uniquely identifies a label.

A label is a tag that you can add to some objects, such as an MQTT topic or session. You can use list actions such as "listTopics" and "listMqSessions" to find objects with a specific label.

The "labelId" property is mutually exclusive with the "label" property.

Example

"labelId": 423

The "maxDeliveryRatePerSecond" property sets the throttle rate for current and new subscribers of the topic. This property is optional. If omitted, it defaults to 0, which means no throttling is applied.

  • It must be a value between 0 and 2,147,483,647, but a more realistic range is between 0 and 1,000. It is useful to keep a client from being overwhelmed with too many messages sent too quickly.

  • You can set it to a number greater than 0 to throttle the delivery rate. This allows you to avoid saturating the network and other resources.

    For example, you can set it to 100 to throttle the delivery to 100 messages per second. This is a maximum setting because the actual message delivery rate is bounded by the network, local resources, the hardware running FairCom's servers, and a client’s ability to process messages quickly.

The "maxInflightMessages" property protects subscribers from receiving messages faster than they can handle. The default value is0. This property is optional.

  • The default value of 0 means there is no maximum limit.

  • This property defines the maximum number of unacknowledged messages that FairCom's servers will send to each subscriber of this topic.

    For example, setting this property to 10 allows FairCom's servers to send up to 10 publish packets to a subscriber before the servers wait for the subscriber to acknowledge receipt of at least one publish packet.

The "metadata" property is an optional JSON object. It exists primarily for the user interface to find integration information. By default, it is an empty JSON object.

  • It contains a flexible set of properties.

  • It typically contains tags and description properties.

Example

{
  "description": "",
  "tags": [""],
  "yourOwnProperties": "usage, purpose, notes, location, etc.",
}

The "sourcePayloadFormat" property is an optional string that specifies the expected data type of the MQTT payload. When omitted or set to null, it defaults to "binary". When the server receives an MQTT message, it always takes the binary value from the MQTT payload and stores it in the source_payload field. The source_payload field is a variant, which means it stores the type of data it contains. If there are no errors in validating the MQTT payload to match the type specified in "sourcePayloadFormat", the server assigns the value of "sourcePayloadFormat" as the variant field's type. 

Depending on the values of the "sourcePayloadFormat" and "validateMqttPayload" properties, the server may validate the MQTT payload to ensure it matches the type. The default value for the "validateMqttPayload" property is true. The server may also convert the MQTT payload into another form before storing it. If the MQTT payload does not match the type or cannot be converted, the server stores the payload in the source_payload field, sets its variant type to "binary", and sets the error field to 1 to indicate there is an error. It also adds an error entry to the JSON array in the log field. 

FairCom's MQTT server does the following when a topic receives an MQTT message and "sourcePayloadFormat" is set to one of the following values:

"sourcePayloadFormat" Value

Description

"binary"

The server stores the MQTT payload in the source_payload field with no validation or conversion and assigns the "binary" type to the field. It ignores the value of "validateMqttPayload".

"json"

The server stores the MQTT payload in the source_payload field.

  • If "validateMqttPayload" is true, it validates the MQTT payload as JSON.

    • If successful, it assigns the "json" type to the source_payload field.

    • If unsuccessful, the server assigns a "binary" type to the source_payload field and sets the error field to 1 to indicate there is an error. It also adds an error entry to the JSON array in the log field.

  • If "validateMqttPayload" is false, it does not validate the MQTT payload and assigns the "json" type to the source_payload field. The publisher must send MQTT messages containing valid JSON, or database queries may return errors.

"utf8"

The server stores the MQTT payload in the source_payload field.

  • If "validateMqttPayload" is true, it validates the MQTT payload as a UTF-8 string.

    • If successful, it assigns the "utf8" type to the source_payload field.

    • If unsuccessful, the server assigns a "binary" type to the field and sets the error field to 1 to indicate there is an error. It also adds an error entry to the JSON array in the log field.

  • If "validateMqttPayload" is false, it does not validate the MQTT payload and assigns the "utf8" type to the source_payload field. The publisher must send MQTT messages containing valid UTF-8, or database queries may return errors.

"variantObject"

The server validates the payload as a variant object.

  • If successful, the server extracts the value from the variant object’s "value" property and assigns it to the value of the source_payload field. It also assigns the variant object’s type to the type of the source_payload field.

  • If unsuccessful, the server writes the MQTT payload to the source_payload field, assigns a  "binary"  type to the field, and sets the error field to  1, to indicate that it also adds an error entry to the JSON array in the log field.

The server ignores the value of "validateMqttPayload". The server always validates "variantObject".

"siemensUdt"

The server stores the MQTT payload in the source_payload field without validation or conversion and assigns the "binary" type to the field. It ignores the value of "validateMqttPayload".

"jpeg"

The server stores the MQTT payload in the source_payload field without validation or conversion and assigns the "binary" type to the field. It ignores the value of "validateMqttPayload".

"xml"

The server stores the MQTT payload in the source_payload field without validation or conversion and assigns the "binary" type to the field. It ignores the value of "validateMqttPayload".

  • This property is a hint to the server about the format and type of the MQTT message payload.

  • This property does not cause server to validate the MQTT payload to see if it matches the type you set. The server stores the payload as is without validation. For example, setting the type to "json", it does not stop the server from receiving and storing a non-JSON value or invalid JSON document in the source payload.

  • The FairCom Edge Explorer application may use the value of this property to determine the default way to display a topic's payload.

  • The transform engine may use the value of this property to help it transform the source payload.

The "newSubscriberDeliveryMode" property defines how new subscribers receive messages. The default is "newMessages".

  • It may be set to one of two values:

    • "newMessages"

    • "storedMessages"

  • When set to "newMessages" new subscribers only receive new messages.

  • When set to "storedMessages" new subscribers will receive some or all previously sent messages. The "newSubscriberDeliveryMode" property defines the maximum number of messages.

The "newSubscriberMaxDeliveredMessages" property is the maximum number of previously stored historical messages a client receives automatically when subscribing to a topic. The default is 0.

  • A value of -1 or "all" defaults to delivering all currently stored messages.

  • A non-negative number limits the delivery of currently stored messages to that number, which may be a maximum of 2,147,483,647 messages.

  • This property only applies when the "newSubscriberDeliveryMode" property is set to "storedMessages".

  • The broker can only send messages stored in the topic’s integration table. The table's retention policy automatically removes old messages.

  • Each time a client unsubscribes from a topic and then subscribes to the topic, the broker sends historical messages as specified by this property. A client can use this behavior to reprocess messages, such as refresh a local data cache or recalculate aggregates.

Note

A topic’s "retentionPolicy", "retentionUnit", and "retentionPeriod" properties define how long the broker retains messages in a topic’s integration table.

The "operationIntent" property is optional. It clarifies the intent of the method as an "insert", "update", or "upsert". The default intent is "upsert".

The "operationIntent" property values and their descriptions are as follows:
  • "upsert"

    This is the default value. It treats this method as an "upsert". If the connection already exists, it updates it.  If the connection does not exist, it inserts it. It does not throw an error.

  • "insert"

    It treats this method as an insert. If the connection already exists, FairCom's servers log an error stating, "Cannot insert service connection xxx because it already exists."

  • "update"

    It treats this method as an update. If the connection does not already exist, FairCom's servers log an error stating, "Cannot update service connection xxx because it does not exist."

The "outputPayloadField" property specifies the field that the MQTT Subscription service should use as the payload when it sends the payload to subscribers. If omitted or if it is an empty string, it defaults to "source_payload".

  • "outputPayloadField" must be one of the following values: 

    • "source_payload"

    • A user-defined field

    This makes it possible for the output from any transform to be used as the payload delivered to subscribers.

The "ownerName" property is an optional string from 1 to 64 bytes that specifies the account that owns an object.

The "rebuildTable" property is an optional Boolean that defaults to false. When true, the server stops accepting read, insert, and update requests and rebuilds the table. Rebuilding a table creates new table files and writes existing records to the new files.

Warning

Rebuilding a table interrupts data collection until the rebuilt operation finishes. The rebuild time is proportional to the number of table records.

Tip

You may want to rebuild the table in the following cases:

  • To apply a transform to previously inserted or updated records.

  • To change the table's retention policy, period, or unit.

  • To repair a data file corrupted by a storage failure.

The "retentionPeriod" property specifies how many units of data to retain. It must be an integer value from 1 to 100. It refers to the unit of time specified by the "retentionUnit" property — for example, if "retentionPeriod" is 14 and "retentionUnit" is "day", then message data is retained for 14 days. This property is optional.

  • Periodically, the system increments the age of each table partition.

    • "Minute" units are incremented at the zero second of each minute, whether the table partition was created 1 second before or 59 seconds before.

    • "Day" units are incremented at midnight GMT, not midnight of the local UTC time zone. A table partition becomes one day old at midnight GMT, whether it was created one second before or 23 hours and 59 seconds before.

    • "Week" units are incremented at midnight GMT on the last day of each week, even if the table partition was created one second before. The last day of the week is Saturday GMT.

    • "Month" units are incremented at midnight GMT on the last day of each month.

    • "Year" units are incremented at midnight GMT on Dec 31.

  • "retentionPeriod" implicitly calculates an upper bound on how many partitions are able to accumulate on your hard drive. However, partitions are not deleted just because this calculated number of partitions is reached. The system also does not restrict the deletion of all partitions.

  • If the FairCom database is shut down for a month, when the database is started up again, all partitions that are retained for less than one month are immediately deleted.

  • If someone purposely or accidentally sets the date to a future date, all partitions immediately become older, and auto-deletion ensues accordingly.

When partitions are auto-purged, some data are maintained "forever" in a global index. Auto-purge does not prevent these files from growing without bounds and filling up your hard drive.

If not specified, the default found in the services.json file is used. Initially, it is 4 (weeks).

Automatically purging data is important to ensure that retained data does not consume all storage and shut down the computer. The default value of 4 weeks allows FairCom's servers to store 1 TB of messages when 200 topics send one 2K message per second.

Note

  • If the value is not an integer from 1 to 100, FairCom's servers set it to the default value.

  • Smaller numbers improve SQL performance.

  • Each time the "retentionPeriod" cycles, FairCom's servers automatically and efficiently delete expired data.

  • The "retentionUnit" and "retentionPeriod" properties are used only when the "retentionPolicy" is set to "autoPurge".

  • FairCom's servers only use the "retentionPeriod" property when the "retentionPolicy" is "autoPurge".

  • The "retentionPeriod" can be changed to retain fewer or more messages. Changing it does not necessarily destroy existing data, but data may expire more quickly or be retained longer.

  • The "retentionPeriod" and "retentionUnit" properties control data granularity as well as the retention time.  In other words, "retentionPeriod" defines how many sets of data are stored, and "retentionUnit" defines how often data is purged.

    For example, if "rententionPeriod" is set to 14 , the server stores 14 sets of data. At the beginning of the 15th cycle, the server automatically purges the oldest set of data. If "retentionUnit" is set to day, then data will be purged daily. If set to "week", then data will be purged weekly.

  • The current calendar date affects purging.

    FairCom's servers automatically purge all retained data that has expired. This is noticeable when FairCom's servers come online after having been offline for a long time. When a server comes back online, it automatically purges all expired data.

    For example, if a FairCom server is offline for four weeks when it comes online, it will completely purge all retained data that has a retention time of less than 4 weeks.

The "retentionPolicy" property controls how messages are persisted. This property is optional.

If not specified, the default found in the services.json file is used. Initially, it is "autoPurge".

retentionPolicy values:
  • "autoPurge"

    This is the default. It is automatically applied when a new topic is created. It is preferred because it allows FairCom's servers to automatically remove messages that are older than the retention time. This helps ensure message data does not consume all storage space. It also minimizes storage costs and speeds up data access. The server partitions a table into multiple files so it can efficiently delete expired files.

  • "neverPurge"

    This stores messages on disk and never removes them. This is useful when you need the entire history of the message stream. If message velocity is high, this can consume all storage space and cause an outage. The server creates a non-partitioned table, which is slightly faster than a partitioned table because it stores all records in one file.

Each time this unit cycles, FairCom purges expired messages. For example, if you want a week's worth of messages to be purged once a week, set "retentionUnit" to "week" . This property is optional.

If not specified, the default found in the services.json file is used. Initially, it is "week"

  • This property is used in concert with "retentionPeriod" to determine retention time.

  • "retentionUnit" values:

    • "minute"

    • "hour"

    • "day"

    • "week"

    • "month"

    • "year"

    • "forever"

Note

  • For best performance, set the "retentionUnit" to a value that keeps "retentionPeriod" between 5 and 30

  • When you set "retentionUnit" property to "forever" the server will not purge messages. This setting is the same as setting "retentionPolicy" to "neverPurge".

  • The "retentionUnit" and "retentionPeriod" properties are used only when the "retentionPolicy" is set to "autoPurge".

The "retrySeconds" property is the number of seconds that FairCom's MQTT broker will wait for the next expected packet from a client during a QoS 1 or QoS 2 PUBLISH packet exchange/PUBLISH handshake with an MQTT client. The default value is 5. It applies when a client is publishing to the broker and when the broker is publishing to a client. This property does not apply to QoS 0 PUBLISH operations because QoS 0 PUBLISH operations are not answered. "retrySeconds" is optional.

  • If the "retrySeconds" time expires, FairCom's broker will disconnect the MQTT client with MQTT error code 7.  MQTT 5 clients will also receive a Reason Code.  An error message will be logged to <faircom>/data/CTSTATUS.FCS explaining why the disconnect happened. For example: 

    MQTT connection for client ID [myMqttClient7] has been disconnected due to inactivity timeout. retrySeconds is set to [25] seconds for topic [my/test/topic12].: 14226

    When the MQTT client reconnects, FairCom's MQTT broker will attempt to resume the PUBLISH handshake by resending the unanswered packet to the client, hoping that the client will reply with the next step of the handshake.

  • The minimum value is 1 and the maximum value is 65535.

  • If "retrySeconds" is omitted or its range is exceeded, FairCom's broker uses the default value.

  • Note that this parameter is not related to MQTT Keep Alive or when PINGREQ packets should be sent by the client.

The "subscribeToExternalBroker" property is optional. When this property is set to a valid broker connection, FairCom 's servers connect to the external MQTT broker and subscribes to this topic on that broker. Thus, these servers become a client to another MQTT broker. Each message sent to this topic on the external broker becomes an incoming message in FairCom 's servers – as if it were sent directly to them . The topic works the same as any other topic.

  • Any client can publish messages to this topic.

  • A valid Broker Connection must be created before you set "subscribeToExternalBroker" to a value (see "configureBrokerConnection").

  • If this broker connection name does not already exist, it does not set up an external subscription and it logs an error stating, "Cannot subscribe to the external broker because the Broker Connection name xxx has not yet been defined by ConfigureBrokerConnection."

The "tableName" property is a string containing the name of an integration table that stores the messages of an MQTT topic.

  • See table name in System limits for table naming requirements and limitations.

  • You must specify a non-empty string for an integration table name.

  • FairCom Edge an FairCom MQ automatically create an integration table for each new MQTT topic they process. The first characters in the table name are "mqtt_msg_" followed by the topic name. Because an MQTT topic can be 65500 bytes and a table name can be 64 bytes, the server may abbreviate the topic name.

  • To better identify the data it holds, rename an integration using the "tableName" property of the "configureTopic" action.

The "threads" property is the number of threads assigned to a topic to write published messages to disk. This property is optional. The default value is 1.

  • The default of 1 is enough to handle typical workloads.

  • For heavy workloads, you may increase the number of threads to 2 or 3.

The topic attribute is a unique user-defined name for the topic.

  • The "topic" name may be up to 65,500 characters long, but it is typically less than 150 characters.

  • The "topic" name will be used in all subsequent references to the topic, such as when re-configuring or deleting the topic.

The "transformName" property is an optional string that contains the unique name of a transform process, which consists of one or more transform steps.

The value of "transformName" must be the name of a transform process you created. It cannot be the name of a FairCom-provided transform method.

You must create a transform before you can assign it to an integration table. See the "createTransform" and "alterTransform" actions.

  • A transform is a process that works like a pipeline where the output of one transformation can become the input for another transformation.

  • The following actions use the "transformName" property to assign a transform to an integration table:

    • "configureTopic"

    • "createInput"

    • "alterInput"

    • "createIntegrationTable"

    • "alterIntegrationTable"