# Auto-publishing module configuration

Transformer has an autopublishing module that allows it to automatically broadcast updated data to connected DataSource peers, even though it is an [active DataSource application](../datasource/datasource-active-subscription-model.md). The `add-autopub` configuration item enables you to specify the subjects that you want Transformer to automatically broadcast.

Here’s a list of all the auto-publishing configuration items; to get more detail, just click on the item you’re interested in.

## Configuration file

Transformer’s auto-publishing configuration must be kept in a separate configuration file called `autopub.conf`.

If you’re using the Deployment Framework, put changes and additions to this configuration in the file `<Framework-root>/global_config/overrides/servers/Transformer/etc/autopub.conf`, where &lt;Framework-root> is the Deployment Framework’s topmost directory.

## add-autopub

`add-autopub` specifies one or more [subject names (symbols)](../datasource/datasource-subjects-symbols-and-fields.md) for which updates can be automatically published (broadcast) to connected DataSource peers, and the conditions under which they’ll be published. You can specify multiple `add-autopub` items for different sets of subjects.

**Syntax:**

```
add-autopub
   xref:id[id]                     [string]
   xref:add-symbol[add-symbol]             [array of strings]
   xref:add-regex[add-regex]              [array of strings}
   xref:disable-by-default[disable-by-default]     [boolean]
   xref:distribute-on-peer-up[distribute-on-peer-up]  [boolean]
   xref:listener-flags[listener-flags]         [integer]
   xref:peer-label[peer-label]             [array of strings]
   xref:send-only-if-primary[send-only-if-primary]   [boolean]
   xref:send-only-once[send-only-once]         [boolean]
end-autopub
```

| Option | Type | Default | Description |
| --- | --- | --- | --- |
| <a name="add-regex"></a>`add-regex` | array of strings | +[none]+ | One or more space separated regular expressions that determine subjects for which updates are automatically broadcast. For example, `add-regex ^/FX/EUR* ^/FX/GBP*` selects updates for all subject names of the form `/FX/EUR<something>` and `/I/GBP<something>` The autopublishing module broadcasts updates for all the subjects specified by `add-regex` and [`add-symbol`](#add-symbol). |
| `<a name="add-symbol"></a>add-symbol` | array of strings | +[none]+ | One or more space separated subject names for which updates are automatically broadcast. For example: `add-symbol /FX/AUDUSD /FX/USDCAD` The autopublishing module broadcasts updates for all the subjects specified by [`add-regex`](#add-regex) and `add-symbol`. |
| <a name="disable-by-default"></a>`disable-by-default` | boolean | `FALSE` | This option only applies to LUA-based pipelines. When this option is `TRUE`, updates for the subjects defined by this `add-autopub` item (see [`add-symbol`](#add-symbol) and [`add-regex`](#add-regex)) aren’t published (broadcast) until they are explicitly enabled by a Lua pipeline. You re-enable publishing through an API call in the pipeline: `autopub_enable_symbol()` enables publishing for a specific subject and `autopub_enable_group()` enables publishing for all eligible subjects in an `add-autopub` item that’s specified by [`id`](#id). The default value of `FALSE` means that all subjects defined by this `add-autopub` item are automatically published until publishing is explicitly disabled by an API function call in a Lua pipeline (call to `autopub_disable_symbol()` or `autopub_disable_group()`). For details of the above API functions, see the [Autopub Module: Pipeline Functions](++/developer/api/transformer_pipeline_sdk/latest/group__pipe__autopub.html++) page in the _[Transformer Pipeline Module API documentation](https://docs.caplin.com/developer/api/transformer_pipeline_sdk/latest/)_. |
| <a name="distribute-on-peer-up"></a>`distribute-on-peer-up` | boolean | `FALSE` | When this option is `TRUE`, if one of the DataSource peers listed in [`peer-label`](#peer-label) goes down, when the peer comes up again, every object in Transformer’s cache that matches a subject specified by [`add-symbol`](#add-symbol) or [`add-regex`](#add-regex) is sent to the peer. When the option is `FALSE`, only _new_ matching updates are sent to the peer when it comes up again. |
| `<a name="id"></a>id` | string | [automatically generated - see description] | A unique identifier for this `add-autopub` item. This is recorded against entries in Transformer’s log file (`var/transformer.log`). The default if you don’t explicitly define an `id` is `autopub-<index>`, where `<index>` is the index position of this `add-autopub` entry in the Transformer configuration, starting at `0`. |
| <a name="listener-flags"></a>`listener-flags` | integer | `0` (no flags) | Flags that control how the autopublishing module listens for updates that are to be broadcast. Values are: * `none` or `0`: When Transformer loads the autopublishing module, it subscribes to all the subjects defined by the [`add-symbol`](#add-symbol) option of this `add-autopub` item, so the module will subsequently receive the updates for all of these subjects and can broadcast them to the DataSource peers specified in [`peer-label`](#peer-label). * `accessory` or `1`: When Transformer loads the autopublishing module, it doesn’t subscribe to any of the subjects defined by the [`add-symbol`](#add-symbol) option of this `add-autopub` item. Subsequently, the module just listens for updates and broadcasts any it receives that are for subjects matching the lists in [`add-symbol`](#add-symbol). `listener-flags` has no effect on subjects that are defined by the [`add-regex`](#add-regex) option. |
| <a name="peer-label"></a>`peer-label`  | array of strings | (none) | A space-separated list of Datasource peers. Updates for subjects defined by this `add-autopub` item (see [`add-symbol`](#add-symbol) and [`add-regex`](#add-regex)) are broadcast to these peers. Each entry in the list must be the value of the [`remote-label`](../datasource/datasource-datasource-peers-configuration-part-1.md#remote-label) option in an [`add-peer`](../datasource/datasource-datasource-peers-configuration-part-1.md#add-peer) item that specifies Transformer’s connection to a DataSource peer. |
| <a name="send-only-if-primary"></a>`send-only-if-primary` | boolean | `FALSE` | When `TRUE`, updates for subjects defined by this `add-autopub` item (see [`add-symbol`](#add-symbol) and [`add-regex`](#add-regex)) are only broadcast if this Transformer is the primary, or only, Transformer in the cluster. |
| <a name="send-only-once"></a>`send-only-once` | boolean | `FALSE` | When this option is `FALSE`, (the default setting), updates for subjects defined by this `add-autopub` item (see [`add-symbol`](#add-symbol) and [`add-regex`](#add-regex)) are broadcast to all the DataSource peers listed in [`peer-label`](#peer-label). When the option is `TRUE`, updates are only sent to the first available (up) DataSource peer in the [`peer-label`](#peer-label) list. This could be useful in a failover situation. For example, assume `peer-label` is specified as: `peer-label primary-peer secondary peer` where `secondary-peer` is the failover peer. Then when `send-only-once` is `TRUE`, `secondary-peer` only gets updates when `primary-peer` has gone down. When `primary-peer` comes back up, updates are sent to `primary-peer` again and not to `secondary-peer`. |

## hashtable-size

`hashtable-size` specifies the size elements of the hash table that keeps track of the publish state.

**Syntax:** `hashtable-size <size-in-table-elements>`

**Type:** integer

**Default value:** `10000` hash table elements
