---
title: "Market Data Gateway configuration reference"
description: "Complete YAML reference for Market Data Gateway: licensing, Geneos instrumentation, Status UI, search, offline ingest, markets, and channel settings."
url: "https://docs.itrsgroup.com/docs/geneos/collection/md-gateway/1.0.0/user-guide/md-gateway-config-ref/index.html"
---
## Overview

This page is the complete reference for `md-gateway.yaml`. For installation, Geneos setup, and published dataviews, see [Market Data Gateway](https://docs.itrsgroup.com/docs/geneos/collection/md-gateway/1.0.0/user-guide/md-gateway/index.html). For an end-to-end sample, see [Complete configuration](#complete-configuration).

### Naming and conventions

- YAML keys — use camelCase (for example, `samplingIntervalMs`, `latencyThresholdMs`). Use camelCase even where kebab-case is also accepted.
- Types — boxed types (`Boolean`, `Integer`, `Long`, `String`) are nullable and default to `null` unless noted. Primitive types (`boolean`, `int`, `long`) always have a default.
- Units — duration fields end in `Ms`, `Seconds`, or `Ns`. Size units are noted in each table.
- Market type — each `markets[]` entry must set `type`. That value is fixed for the feed: it selects the transport and the recovery fields. You do not choose the transport separately. A `unicast` block on a multicast type is ignored. A `multicast` block on a unicast type is ignored. Contact your ITRS account manager for the `type` value for each feed.
- Transport family — [Multicast](#multicast-feeds) types use `channels[].multicast` with redundant channels. Recovery is cross-channel, then retransmit, then snapshot. [Unicast](#unicast-session) types use `channels[].unicast` with exactly one channel per partition; the session handles recovery. The `type` value selects the family; you do not choose the transport separately.

## Credential handling


**Important**

 Do not store passwords, member IDs, or other secrets as plaintext in `md-gateway.yaml`. Use environment-variable substitution. 


At load time, values of the form `${env:VAR_NAME}` are replaced with the value of the environment variable `VAR_NAME`. `${env:VAR_NAME:default}` uses `default` when `VAR_NAME` is unset.


**Important**

 An unset variable with no default does not stop MD Gateway. The value becomes an empty string and only a WARN line is logged. A missing secret then fails later, for example, when logging in to a feed. After you change the process environment, check the startup log for these warnings. 


Typical fields to inject:

- Snapshot recovery credentials supplied with the feed: `username`, `password`
- Unicast session: `username`, `password`
- Host-specific values such as interface names or hostnames when they differ by environment

```yaml
unicast:
  username: ${env:FEED_USER}
  password: ${env:FEED_PASS}
```

Set each variable in the environment of the process that starts MD Gateway. A systemd service does not inherit the shell you use to run `systemctl`.

On Linux, add the variables to a drop-in:

```bash
sudo systemctl edit md-gateway
```

```text
[Service]
Environment=FEED_USER=...
Environment=FEED_PASS=...
```

Restart the service afterward. This is the same drop-in as [Configure JVM options](https://docs.itrsgroup.com/docs/geneos/collection/md-gateway/1.0.0/user-guide/md-gateway/index.html#configure-jvm-options). A foreground start can `export` the variables in the shell that runs `md-gateway.sh`.

On Windows, a foreground start can `set` the variables in that Command Prompt before `md-gateway.bat`. For an NSSM service, one `AppEnvironmentExtra` value replaces the whole list, so include every variable in that one command, including `JAVA_OPTS` if you set it this way:

```bat
nssm set MDGateway AppEnvironmentExtra "JAVA_OPTS=-Xms4g -Xmx4g -XX:+UseG1GC -XX:+HeapDumpOnOutOfMemoryError" FEED_USER=... FEED_PASS=...
nssm restart MDGateway
```

See also [Market Data Gateway](https://docs.itrsgroup.com/docs/geneos/collection/md-gateway/1.0.0/user-guide/md-gateway/index.html).

## Top-level configuration

The fields in this table are the top level of `md-gateway.yaml`.

| Field | Type | Description |
| --- | --- | --- |
| `licensing` | [LicensingConfig](#licensing) | Licence Daemon connection, or evaluation with [`demoMode`](#licensing).
Mandatory: Yes |
| `instrumentation` | [InstrumentationConfig](#instrumentation) | Geneos dataview publishing. `geneos.enabled` must be `true`.
Mandatory: Yes |
| `statusServer` | [StatusServerConfig](#status-server) | Built-in HTTP Status UI and JSON API. Omit or set `enabled: false` to disable. |
| `search` | [SearchConfig](#search) | Optional message-search store. Omit or set `enabled: false` to disable. |
| `offlineIngest` | [OfflineIngestConfig](#offline-ingest) | Optional offline capture lane for supported capture files. Omit the section, or set `enabled: false`, to turn it off. See [Offline ingest](#offline-ingest). |
| `markets` | list of [MarketDataMonitorConfig](#markets) | One entry per market feed. Must contain at least one market, unless `offlineIngest.enabled` is `true`. An analysis-only instance can declare `markets: []`.
Mandatory: Yes (or empty when offline ingest is enabled) |

## Licensing

YAML key: `licensing`

Each enabled market requests a Licence Daemon token of the form `plugin/md-gateway-<type>`, where `<type>` is that market's YAML `type` value. Licence Daemon administrators need that token name for every feed you run. At startup, markets stay dark until each token is granted.

| Token state | Behavior |
| --- | --- |
| `AVAILABLE` | Build and start that market. Cancels any pending grace stop. |
| `UNAVAILABLE` | Stop and discard that market immediately. |
| `PENDING` or `UNKNOWN` | Keep the market running for a 24-hour grace period, then stop and discard it. A return to `AVAILABLE` before the timer fires cancels the stop. |

The grace period rides out transient Licence Daemon reconnects. An explicit `UNAVAILABLE` grant loss stops immediately. The grace period is not user-configurable.

In normal mode, MD Gateway connects to the Licence Daemon. When `demoMode` is `true`, the Licence Daemon is not contacted: every configured market is granted locally for seven days from the start of the license service, and other Licence Daemon fields such as `host` and `port` are ignored.

| Field | Type | Description |
| --- | --- | --- |
| `demoMode` | boolean | When `true`, grant every market locally for seven days without the Licence Daemon.
Default: `false` |
| `host` | string | Hostname or IP of the Licence Daemon.
Mandatory: Yes, unless `demoMode` is `true` |
| `port` | int | TCP port of the Licence Daemon.
Default: `7041` |
| `instanceId` | string | Unique instance identity. When omitted, derived from the binary ID (`md-gateway`), hostname, and process ID.
Default: derived |
| `tls` | boolean | Use TLS for the Licence Daemon connection. Certificate material in `tlsConfig` also enables TLS.
Default: `false` |
| `tlsConfig` | [TlsConfig](#licensing-tls-configuration) | Client TLS for the Licence Daemon connection. Same shape as [`instrumentation.geneos.tlsConfig`](#geneos-tls-configuration). See [Licensing TLS configuration](#licensing-tls-configuration). |
| `heartbeatIntervalMs` | int | Heartbeat interval for the Licence Daemon connection.
Default: `30000` |
| `autoReconnect` | boolean | Reconnect automatically after a Licence Daemon disconnect.
Default: `true` |

### Licensing TLS configuration

YAML key: `licensing.tlsConfig`

Optional TLS settings for the outbound Licence Daemon connection. TLS is enabled when `licensing.tls` is `true`, or when `certFile` or `trustChainFile` is set. Ignored when `demoMode` is `true`.

| Field | Type | Description |
| --- | --- | --- |
| `certFile` | String | Path to the client X.509 certificate PEM presented to the Licence Daemon. |
| `keyFile` | String | Path to the matching PKCS#8 private key PEM (`BEGIN PRIVATE KEY`). Requires `certFile`. |
| `trustChainFile` | String | Path to a CA trust-chain PEM used to verify the Licence Daemon server certificate. |
| `requireClientAuth` | boolean | Ignored for licensing (server-only field shared with Geneos probe TLS).
Default: `false` |
| `minTlsVersion` | String | Minimum TLS protocol version (`"1.2"` or `"1.3"`). Quote the value in YAML.
Default: `"1.3"` |

```yaml
licensing:
  host: licd.example.com
  port: 7041
  tls: true
  tlsConfig:
    trustChainFile: /certs/licd-ca.pem
    minTlsVersion: "1.2"
```

Evaluation without a Licence Daemon:

```yaml
licensing:
  demoMode: true
```

## Instrumentation

YAML key: `instrumentation`

MD Gateway refuses to start if this section is absent or if `geneos.enabled` is not `true`.

| Field | Type | Description |
| --- | --- | --- |
| `geneos` | [GeneosConfig](#geneos-instrumentation) | Geneos dataview publishing configuration.
Mandatory: Yes |

### Geneos instrumentation

YAML key: `instrumentation.geneos`

MD Gateway listens on `listenPort` acting as a Netprobe. Geneos Gateway connects to that port and pushes sampler configuration. Dataview publishing activates after the probe receives a sampler whose name matches `samplerName` and whose managed entity matches `managedEntity`. Define that sampler with the `api-streams` plugin. For probe, managed entity, and sampler setup on the Geneos side, see [Configure the Gateway Setup Editor](https://docs.itrsgroup.com/docs/geneos/collection/md-gateway/1.0.0/user-guide/md-gateway/index.html#configure-the-gateway-setup-editor). For listen-socket TLS fields, see [Geneos TLS configuration](#geneos-tls-configuration).

| Field | Type | Description |
| --- | --- | --- |
| `enabled` | boolean | Enable Geneos dataview publishing. Startup fails if absent or `false`.
Default: `false`
Mandatory: Yes (must be `true`) |
| `listenPort` | int | TCP port on which MD Gateway listens for the Geneos Gateway connection.
Default: `0`
Mandatory: Yes if enabled |
| `probeName` | String | Netprobe name registered in the Gateway configuration.
Mandatory: Yes if enabled |
| `managedEntity` | String | Managed entity name under which dataviews are published.
Mandatory: Yes if enabled |
| `samplerName` | String | Sampler name used for the published dataviews.
Mandatory: Yes if enabled |
| `selfMonitoringIntervalMs` | long | Publish interval for self-monitoring dataviews (ms).
Default: `10000` |
| `marketDataIntervalMs` | long | Publish interval for market-data dataviews (ms).
Default: `5000` |
| `rateWindowSeconds` | int | Rolling window (seconds) for the windowed rate columns of the market-data dataviews (for example, the feeds `messageRate` and the books `updateRate`). The **Protocol-Status** dataview has its own [`protocolStatus.rateWindowSeconds`](#protocol-status).
Default: `60` |
| `jvmMetrics` | boolean | Publish the JVM Self Monitoring dataview. Set `false` to keep Geneos enabled without that loop.
Default: `true` |
| `tlsConfig` | [TlsConfig](#geneos-tls-configuration) | TLS or mTLS for the probe listen socket. Omit (or omit `certFile`) for plaintext. See [Geneos TLS configuration](#geneos-tls-configuration). |
| `books` | [BooksConfig](#books-configuration) | Top-of-book (BBO) dataview configuration. |
| `protocolStatus` | [ProtocolStatusConfig](#protocol-status) | Windows and thresholds for the **Protocol-Status** dataview. Defaults apply when omitted.
See [Protocol Status](#protocol-status). |
| `searchCommands` | [SearchCommandsConfig](#search-commands) | Probe-published Geneos search commands and per-search `Search-Results-NNN` dataviews. Wired when [`search`](#search) or offline ingest is enabled. See [Search commands](#search-commands). |

```yaml
instrumentation:
  geneos:
    enabled: true
    listenPort: 7036
    probeName: MDGatewayProbe
    managedEntity: md-gateway
    samplerName: MDGateway
    selfMonitoringIntervalMs: 10000
    marketDataIntervalMs: 5000
    rateWindowSeconds: 60
```

#### Geneos TLS configuration

YAML key: `instrumentation.geneos.tlsConfig`

TLS or mTLS for the Geneos probe listen socket. MD Gateway is the TLS server; Geneos Gateway is the client. Same field shape as [`licensing.tlsConfig`](#licensing-tls-configuration).

| Mode | MD Gateway | Geneos Gateway |
| --- | --- | --- |
| Plaintext | Omit `tlsConfig`, or omit `certFile` | Probe without `<secure>` |
| TLS | `certFile` + `keyFile` (PKCS#8) | `<secure>true</secure>` plus Gateway SSL certificate and chain that trusts the probe certificate |
| mTLS | TLS material + `trustChainFile` + `requireClientAuth: true` | Same as TLS; Gateway must present a client certificate |

| Field | Type | Description |
| --- | --- | --- |
| `certFile` | String | Path to the probe X.509 certificate PEM. When set, MD Gateway presents this certificate on the listen socket. |
| `keyFile` | String | Path to the matching PKCS#8 private key PEM (`BEGIN PRIVATE KEY`). PKCS#1 keys are not supported; convert with `openssl pkcs8 -topk8 -nocrypt -in key.pem -out key-pkcs8.pem`. If omitted, EMF2 looks for the key in the certificate file. |
| `trustChainFile` | String | Path to a CA trust-chain PEM used to verify the Gateway client certificate (mTLS). Required when `requireClientAuth` is `true`. |
| `requireClientAuth` | boolean | When `true`, require a client certificate trusted by `trustChainFile` (mutual TLS).
Default: `false` |
| `minTlsVersion` | String | Minimum TLS protocol version (`"1.2"` or `"1.3"`). Quote the value in YAML. Applied only when `certFile` is set.
Default: `"1.3"` |

TLS example:

```yaml
instrumentation:
  geneos:
    enabled: true
    listenPort: 7036
    probeName: MDGatewayProbe
    managedEntity: md-gateway
    samplerName: MDGateway
    tlsConfig:
      certFile: /path/to/md-gateway.crt
      keyFile: /path/to/md-gateway-key.pem
      minTlsVersion: "1.3"
```

mTLS example:

```yaml
instrumentation:
  geneos:
    enabled: true
    listenPort: 7036
    probeName: MDGatewayProbe
    managedEntity: md-gateway
    samplerName: MDGateway
    tlsConfig:
      certFile: /path/to/md-gateway.crt
      keyFile: /path/to/md-gateway-key.pem
      trustChainFile: /path/to/rootCA.pem
      requireClientAuth: true
      minTlsVersion: "1.3"
```

On the Geneos Gateway side, mark the probe secure and supply SSL identity plus a CA chain that trusts the probe certificate. For example:

```text
gateway2.linux_64 ... \
  -ssl-certificate /path/to/gateway.pem \
  -ssl-certificate-key /path/to/gateway-key.pem \
  -ssl-certificate-chain /path/to/rootCA.pem
```

For the probe XML and Gateway Setup Editor steps, see [Add the probe](https://docs.itrsgroup.com/docs/geneos/collection/md-gateway/1.0.0/user-guide/md-gateway/index.html#add-the-probe).

#### Books configuration

YAML key: `instrumentation.geneos.books`

Controls top-of-book (BBO) dataview publishing.

| Field | Type | Description |
| --- | --- | --- |
| `mode` | Enum | BBO publishing mode: `TOP_N` publishes the busiest books; `OFF` publishes no BBO dataviews. `SUBSCRIPTION` is reserved and not implemented: it logs a warning and publishes no BBO dataviews.
Default: `TOP_N` |
| `topN` | int | When `mode` is `TOP_N`, the number of busiest books to publish per market type.
Default: `20` |

```yaml
instrumentation:
  geneos:
    enabled: true
    books:
      mode: TOP_N
      topN: 20
```

#### Protocol Status

YAML key: `instrumentation.geneos.protocolStatus`

Windows and thresholds for the **Protocol-Status** dataview: one row per running market instance (row key: market name). The block is optional; defaults apply when omitted. For the published columns and headlines, see [Protocol-Status](https://docs.itrsgroup.com/docs/geneos/collection/md-gateway/1.0.0/user-guide/md-gateway/index.html#protocol-status).

| Field | Type | Units | Description |
| --- | --- | --- | --- |
| `rateWindowSeconds` | int | s | Rolling window for `messageRate (/s)` and the trading-day `peakRate (/s)`. Independent of the shared `rateWindowSeconds`. Must be at least 1.
Default: `10` |
| `channelUpThresholdSeconds` | int | s | A channel counts as up when any packet (data or heartbeat) arrived within this age. Must be at least 1.
Default: `5` |
| `staleFeedThresholdSeconds` | int | s | `staleFeed` is `true` when no channel of the market has received an application message within this age, or none has received one yet. Must be at least 1.
Default: `30` |

```yaml
instrumentation:
  geneos:
    protocolStatus:
      rateWindowSeconds: 10
      channelUpThresholdSeconds: 5
      staleFeedThresholdSeconds: 30
```

Only `messagesToday` and `peakRate (/s)` reset at local midnight in the market's `tradingDayZone` (when unset: the MD Gateway-wide `search.tradingDayZone` if search is enabled, otherwise the host's system default zone). Other counters are since MD Gateway start.

#### Search commands

YAML key: `instrumentation.geneos.searchCommands`

Exposes message search as probe-published Geneos commands. When `enabled` is `true` and either [`search`](#search) or offline ingest is enabled, the probe publishes **Search Messages**, clear commands, **Compare Messages**, and (depending on features) **Search Latency**, offline capture commands, and **Export Search Result**. Each search creates its own results dataview named `<resultsDataviewName>-NNN` (for example, `Search-Results-001`). Beyond `maxResultViews`, the oldest view of that kind is removed. For Active Console usage, see [Search Messages](https://docs.itrsgroup.com/docs/geneos/collection/md-gateway/1.0.0/user-guide/md-gateway/index.html#search-messages).

| Field | Type | Description |
| --- | --- | --- |
| `enabled` | boolean | Enable the search commands. They are wired only when `search.enabled` is `true` or offline ingest is enabled. With neither, this setting has no effect.
Default: `false` |
| `resultsDataviewName` | String | Name prefix of the per-search results dataviews (`<prefix>-NNN`). Must not be blank or contain `"`, `*`, `?`, or `=`. Must not equal or overlap the fixed comparison dataview name `Log Compare Results` or the fixed latency search prefix `Latency-Search-Results`. Startup fails if any of these checks fail.
Default: `Search-Results` |
| `exportDir` | String | Directory on the MD Gateway host that **Export Search Result** writes CSV files to. Created on first use. Leave unset to omit the export command. |
| `queryTimeoutMs` | long | Maximum time the pop-up waits for the query before returning a "still running" note.
Default: `10000` |
| `defaultLookbackMinutes` | int | Default lookback when the live search or latency search command supplies no `from` bound. For latency search, the lookback is also clamped to [`search.maxLatencyWindowMinutes`](#search).
Default: `30` |
| `maxResultViews` | int | Maximum number of result dataviews kept live per kind. Search results, comparison results, and latency search results are capped independently; the oldest of that kind is removed when a new run exceeds the cap.
Default: `5` |

```yaml
instrumentation:
  geneos:
    enabled: true
    searchCommands:
      enabled: true
      resultsDataviewName: Search-Results
      exportDir: /var/lib/md-gateway/reports
      maxResultViews: 5
      queryTimeoutMs: 10000
      defaultLookbackMinutes: 30
```

## Status server

YAML key: `statusServer`

Built-in HTTP server for the Status UI and JSON snapshot endpoints. See [Status UI](https://docs.itrsgroup.com/docs/geneos/collection/md-gateway/1.0.0/user-guide/md-gateway/index.html#status-ui).


**Important**


The Status UI has no authentication and listens on all interfaces. There is no bind-address setting. Leave it disabled unless you need it for diagnostics, and restrict access to its port with a firewall when you enable it.




| Field | Type | Units | Description |
| --- | --- | --- | --- |
| `enabled` | boolean | — | Enable the Status UI HTTP server.
Default: `false` |
| `port` | int | — | HTTP listen port.
Default: `8080` |
| `snapshotIntervalMs` | long | ms | MD Gateway-wide minimum interval between internal order-book snapshot publishes. Markets use this value unless they set their own [`snapshotIntervalMs`](#markets). This is not the rate at which data is sent to clients. It applies even when `enabled` is `false`. When the `statusServer` block is absent, the interval is `200`.
Default: `200` |
| `refreshIntervalMs` | long | ms | Auto-refresh interval for the browser UI.
Default: `1000` |

```yaml
# No authentication; listens on all interfaces. Leave enabled: false unless
# you need it for diagnostics, and firewall the port when you turn it on.
statusServer:
  enabled: true
  port: 8080
  snapshotIntervalMs: 500
  refreshIntervalMs: 1000
```

## Search

YAML key: `search`

Optional message-search subsystem. Captures received messages into an embedded store for retrieval through `GET /api/search` and the Geneos Search Messages command. Omit the section or set `enabled: false` for zero footprint.


**Note**


Enabling `search` adds JVM heap demand and substantial native memory outside `-Xmx`. Use at least 4 GB heap and size the host limit with headroom. See [Host sizing](https://docs.itrsgroup.com/docs/geneos/collection/md-gateway/1.0.0/user-guide/md-gateway/index.html#host-sizing).



| Field | Type | Units | Description |
| --- | --- | --- | --- |
| `enabled` | boolean | — | Enable message-search capture and the `/api/search` endpoint.
Default: `false` |
| `questdbDir` | String | — | Filesystem directory for the embedded search store.
Mandatory: Yes if enabled |
| `minFreeDiskMb` | long | MiB | Free-space floor on the `questdbDir` volume. Search and capture writes pause while usable space is below this floor, instead of the process crashing, and resume once usable space is above the floor plus one-tenth of it. `0` disables the guard, and MD Gateway logs a warning at startup.
Default: `4096` |
| `ringSizeBytes` | int | bytes | Per-partition capture ring capacity in bytes. Must be a power of two.
Default: `8388608` (8 MiB) |
| `retentionDays` | int | days | Drop day partitions older than this.
Default: `7` |
| `retentionCheckIntervalMinutes` | int | min | How often the retention task runs.
Default: `60` |
| `retentionInitialDelayMinutes` | int | min | Delay before the first retention run after start.
Default: `5` |
| `walApplyIdleSleepMs` | int | ms | Idle-sleep interval for the background write-apply workers.
Default: `1000` |
| `walApplyWorkers` | int | — | Number of write-apply worker threads. Clamped to at least 1. Set to `1` for single-threaded apply.
Default: `min(8, max(2, CPUs / 2))` |
| `commitMaxFrames` | int | frames | Commit after this many appended frames (or `commitMaxIntervalMs`, whichever comes first).
Default: `256` |
| `commitMaxIntervalMs` | int | ms | Time-based commit trigger for pending rows.
Default: `100` |
| `maxLatencyWindowMinutes` | int | min | Widest `from`..`to` window a latency search (`GET /api/search?minLatencyMs=` or the Geneos **Search Latency** command) may span. A wider window is rejected. A latency search with a blank `from` looks back `searchCommands.defaultLookbackMinutes`, clamped to this cap. Must be positive.
Default: `60` |
| `tradingDayZone` | String | — | Gateway-wide IANA time zone for the instrument trading-day boundary and for **Protocol-Status** `messagesToday` / `peakRate (/s)` midnight reset when a market does not set its own zone. Per-market override available under common market fields.
Default: `UTC` |
| `webConsole` | object | — | Optional diagnostic SQL console over the search store (`enabled`, `host` default `127.0.0.1`, `port` default `9000`). Leave disabled for normal deployments. If enabled, bind to loopback only—the console can run arbitrary SQL against the store.
Default: disabled |
| `channelAudit` | [ChannelAuditConfig](#channel-audit) | Optional per-line raw-packet capture for multicast channels. Omit the section, or set `enabled: false`, for zero footprint. See [Channel audit](#channel-audit). |

### Channel audit

YAML key: `search.channelAudit`

When enabled, channel audit stores what each redundant multicast feed line received (one row per raw packet per line), upstream of arbitration. It complements the normalized message-search store. It has no effect on unicast markets. Both `search.enabled` and `channelAudit.enabled` must be `true`.

| Field | Type | Description |
| --- | --- | --- |
| `enabled` | boolean | Turns channel audit on or off. When `false`, MD Gateway creates no tables, tap, ring, threads, or related memory.
Default: `false` |
| `retentionDays` | int | Retention for the high-volume capture tables. Independent of `search.retentionDays`.
Default: `3` |
| `ringSizeBytes` | int | Capacity of each capture ring. If a ring is too small, jumbo packets are dropped without a warning.
Default: `8388608` |

To exclude a line from capture, set `capture: false` on that channel under [`markets[].partitions[].channels[]`](#channels).

When channel audit is on, MD Gateway publishes the [Channel Capture](https://docs.itrsgroup.com/docs/geneos/collection/md-gateway/1.0.0/user-guide/md-gateway/index.html#channel-capture) dataview and Status UI routes under `/api/search/channels/` (packets, discrepancies, and recovery). The recovery table exists, but this release does not write recovery events to it.


**Important**


Per-channel capture multiplies write and storage load by the number of lines. Before you enable it, budget extra heap (start at about 6 GB), raise `walApplyWorkers` if needed, size `-XX:MaxDirectMemorySize` for the capture rings, and size host memory for the QuestDB off-heap page cache.



```yaml
search:
  enabled: true
  questdbDir: /var/lib/md-gateway/search
  minFreeDiskMb: 4096
  channelAudit:
    enabled: true
    retentionDays: 3
    ringSizeBytes: 8388608
```

Create `/var/lib/md-gateway/search` and give it to the service user before the first start. See [Enable search](https://docs.itrsgroup.com/docs/geneos/collection/md-gateway/1.0.0/user-guide/md-gateway/index.html#enable-search).

## Offline ingest

YAML key: `offlineIngest`

The offline capture lane decodes supported capture files for the types supplied to you from a watched folder into a second, separate embedded store, and then exposes them to the Geneos search, comparison, and export commands. It does not connect to a market. Omit the section, or set `enabled: false`, for zero footprint.

When `enabled` is `true`, you can set `markets: []` so an analysis-only instance runs with no feed. Use a dedicated offline instance with no live `search` block. For setup and operator steps, see [Offline instance and log ingestion](https://docs.itrsgroup.com/docs/geneos/collection/md-gateway/1.0.0/user-guide/md-gateway/index.html#offline-instance-and-log-ingestion).

| Field | Type | Units | Description |
| --- | --- | --- | --- |
| `enabled` | boolean | — | Enables the offline capture lane. When `false`, the other fields in this section are ignored.
Default: `false` |
| `dataDir` | String | — | Root drop folder. Swept once after start, and then polled. The lane never writes to this folder.
Mandatory: Yes if enabled |
| `sources` | map of String to String | — | Pinned lanes: subfolder name (a plain name with no `/`, `\`, or `..`) mapped to the market `type` that decodes files in that folder. Each value must be a market type that has an offline protocol provider on the classpath. Otherwise, startup fails. Contact your ITRS account manager for the `type` values for your captures.
Default: empty |
| `ledgerFile` | String | — | Path of the TSV ledger of already-ingested files. Must resolve outside `dataDir`. Omit to turn off ledger tracking. Without a ledger, every file is re-examined on every restart.
Default: none |
| `pollIntervalMs` | long | ms | Delay between the end of one drop-folder poll and the start of the next. Must be positive.
Default: `1000` |
| `questdbDir` | String | — | Directory for the offline lane's embedded store. Must differ from `search.questdbDir`.
Mandatory: Yes if enabled |
| `minFreeDiskMb` | long | MiB | Free-space floor on the offline `questdbDir` volume. A file being ingested fails while usable space is below this floor, stays out of the ledger, and is read again at the next start. `0` disables the guard.
Default: `4096` |
| `retentionDays` | int | days | Day partitions older than this value are dropped. The default keeps data effectively indefinitely.
Default: `36500` |
| `tradingDayZone` | String | — | IANA time zone whose midnight bounds the instrument trading day for the offline store (symbol resolution).
Default: `UTC` |

```yaml
offlineIngest:
  enabled: true
  dataDir: /var/lib/md-gateway/offline/incoming
  sources:
    order-level: "<type>"
    price-level: "<type>"
  ledgerFile: /var/lib/md-gateway/offline/ingest.ledger
  pollIntervalMs: 1000
  questdbDir: /var/lib/md-gateway/offline/search
  minFreeDiskMb: 4096
  retentionDays: 36500
  tradingDayZone: UTC

markets: []
```


**Important**


If you enable `offlineIngest` together with live `search`, the process runs two embedded QuestDB engines and roughly doubles native off-heap memory. For production, run the offline lane in its own dedicated instance with no `search` block and with `markets: []`.



## Markets

YAML key: `markets[]`

Each entry defines one market to monitor. The `type` value is fixed for the feed and selects the transport and the recovery fields. You do not choose the transport separately. The market starts only after the Licence Daemon grants that type. Contact your ITRS account manager for the `type` value for each feed. When [`offlineIngest.enabled`](#offline-ingest) is `true`, you can declare `markets: []` for an analysis-only instance.

### Common market fields

| Field | Type | Units | Description |
| --- | --- | --- | --- |
| `type` | String | — | Market type supplied for this feed. Selects the transport and the recovery fields. The market starts only when the Licence Daemon grants this type.
Mandatory: Yes |
| `name` | String | — | Unique market name used in metrics, logs, and UI.
Mandatory: Yes |
| `enabled` | Boolean | — | Set `false` to skip this market without removing its config. Omitted or `null` means enabled. Channel-level [`enabled`](#channels) works the opposite way.
Default: `null` (treated as enabled) |
| `slo` | [SloConfig](#slo-configuration) | — | Per-market SLO thresholds and windows. |
| `recovery` | [RecoveryConfig](#recovery-configuration) | — | Gap recovery parameters for multicast feeds (cross-channel, then retransmit, then snapshot). |
| `probeConfig` | [RecoveryServiceMonitorConfig](#probe-configuration) | — | Health-probe interval settings for retransmit and snapshot services on multicast feeds. |
| `snapshotIntervalMs` | long | ms | Minimum interval between internal order-book snapshot publishes for this market. When omitted, the value is taken from [`statusServer.snapshotIntervalMs`](#status-server), or `200` when there is no `statusServer` block. The [Complete configuration](#complete-configuration) sets `statusServer.snapshotIntervalMs: 500` and does not set this field on its markets, so those markets use `500`. |
| `tradingDayZone` | String | — | Per-market IANA time zone whose midnight bounds the market's trading day for message-search instrument boundaries and for the **Protocol-Status** dataview (`messagesToday` and `peakRate (/s)` reset). Blank or `null` falls back to the MD Gateway-wide [`search.tradingDayZone`](#search) when search is enabled, otherwise to the host's system default zone.
Default: `null` |
| `matchingStates` | list of String | — | Exchange state names during which a crossed or locked book is a fault for the `Books-<TYPE>-Unhealthy` dataview. Each plugin ships its own table, so leave this unset unless you need to replace that set. Names are compared case-insensitively; state names the plugin does not know are no longer reported when this list is set.
Default: `null` (use the plugin's table) |
| `partitions` | list of [PartitionConfig](#partitions) | — | One entry per exchange partition. Must contain at least one.
Mandatory: Yes |

### Multicast feeds

The `type` value supplied for the feed selects this transport. Channels use [`multicast`](#multicast) with redundant channels. Recovery is cross-channel, then retransmit, then snapshot. A `unicast` block on this type is ignored. Retransmit and snapshot settings are in the configuration supplied for the feed. Each of those services runs only when its `enabled` flag is explicitly `true`. If omitted, the feature is disabled. See [Complete configuration](#complete-configuration) for the fields.

### Unicast session

The `type` value supplied for the feed selects this transport. Use exactly one channel per partition and a [`unicast`](#unicast) block. The session handles recovery. A `multicast` block on this type is ignored.

### SLO configuration

YAML key: `markets[].slo`

Service-level objective thresholds for latency and inter-channel drift.

| Field | Type | Units | Description |
| --- | --- | --- | --- |
| `latencyThresholdMs` | int | ms | Exchange-to-receive latency SLO.
Default: `1` |
| `lagDriftThresholdMs` | int | ms | Cross-channel receive-timestamp LAG threshold (peer behind the reference channel).
Default: `50` |
| `leadDriftThresholdMs` | int | ms | Cross-channel receive-timestamp LEAD threshold (peer ahead of the reference channel).
Default: `50` |
| `shortWindowSeconds` | int | s | Length of the short rolling window.
Default: `10` |
| `longWindowSeconds` | int | s | Length of the long rolling window. Should be at least `shortWindowSeconds`.
Default: `300` |
| `staleBookThresholdSeconds` | int | s | A book with no updates within this period is counted as stale.
Default: `30` |
| `latencyDescription` | String | — | Human-readable description exported with the latency SLO metric.
Default: *(sensible default)* |
| `driftDescription` | String | — | Human-readable description exported with the drift SLO metric.
Default: *(sensible default)* |

### Recovery configuration

YAML key: `markets[].recovery`

Tunes gap recovery for multicast feeds (cross-channel, then retransmit, then snapshot).

| Field | Type | Units | Description |
| --- | --- | --- | --- |
| `crossChannelBufferSize` | int | entries | Circular buffer size for tier-1 cross-channel fill.
Default: `2048` |
| `crossChannelWaitMs` | long | ms | How long to wait for the other channel before escalating to retransmit.
Default: `500` |
| `retransmitThreshold` | long | messages | Maximum gap size eligible for retransmit. Larger gaps skip to snapshot.
Default: `1000` |
| `retransmitTimeoutMs` | long | ms | Timeout per retransmit request attempt.
Default: `500` |
| `maxRetransmitRetries` | int | — | Retransmit attempts after a transport failure before escalating to snapshot. A retransmit that completes but leaves the gap escalates at once.
Default: `3` |

### Probe configuration

YAML key: `markets[].probeConfig`

Periodic health probes against retransmit and snapshot services.

| Field | Type | Units | Description |
| --- | --- | --- | --- |
| `enabled` | boolean | — | Master switch for recovery-service probing.
Default: `true` |
| `retransmitEnabled` | boolean | — | Enable retransmit probing.
Default: `true` |
| `retransmitIntervalSeconds` | int | s | Retransmit probe interval.
Default: `60` |
| `snapshotLoginEnabled` | boolean | — | Enable a lightweight snapshot probe (connection and log-in only).
Default: `true` |
| `snapshotLoginIntervalSeconds` | int | s | Lightweight probe interval.
Default: `60` |
| `snapshotRecoveryEnabled` | boolean | — | Enable a deep snapshot probe.
Default: `true` |
| `snapshotRecoveryIntervalSeconds` | int | s | Deep probe interval.
Default: `600` |
| `snapshotRecoveryMaxMessages` | int | messages | Messages to read during each deep probe.
Default: `10` |
| `rollingWindowSize` | int | samples | Number of recent probes retained for health statistics.
Default: `20` |

## Partitions

YAML key: `markets[].partitions[]`

| Field | Type | Description |
| --- | --- | --- |
| `number` | Integer | Partition number, as supplied for the feed. MD Gateway does not check range, contiguity, or uniqueness. Give each partition of a market a distinct number. It keys that partition's metrics, dataview rows, and search scope (`market/partition`).
Mandatory: Yes |
| `channels` | list of [ChannelConfig](#channels) | Channels for this partition. Multicast typically uses two (`A` and `B`). Unicast uses one.
Mandatory: Yes |

### Channels

YAML key: `markets[].partitions[].channels[]`

| Field | Type | Description |
| --- | --- | --- |
| `name` | String | Channel name. Conventionally `A`/`B` for multicast. Must be unique within the partition.
Mandatory: Yes |
| `enabled` | Boolean | For multicast feeds, start this channel only when the value is explicitly `true`. Omitted, `null`, or `false` leaves the channel disabled. This is the opposite of market-level `enabled`. Unicast sessions ignore this field. A unicast market that starts must set [`unicast.enabled: true`](#unicast). To leave that market stopped, set market-level `enabled: false`.
Default: `null` (disabled) |
| `reference` | Boolean | Mark as the reference channel. For multicast feeds, exactly one enabled channel per partition must set `reference: true`. That channel's retransmit and snapshot settings build tier-2 and tier-3 recovery, and it retains the last received payload for probe diagnostics. On other enabled channels, those settings drive health probes only. Unicast sessions ignore this field.
Default: `null` |
| `crossChannelFill` | Boolean | Whether this channel contributes to tier-1 cross-channel fill.
Default: `true` |
| `driftMetrics` | Boolean | Whether this channel is included in pairwise drift metrics.
Default: `true` |
| `sloMode` | Enum | `STRICT`, `DRIFT_ADJUSTED`, or `IGNORED`. When unset: `STRICT` for the reference channel, `DRIFT_ADJUSTED` otherwise.
Default: derived |
| `capture` | Boolean | Include this redundant line in [`search.channelAudit`](#channel-audit) raw-packet capture. Set `false` to exclude a line for volume control. Has no effect when channel audit is off.
Default: `true` |
| `multicast` | [MulticastConfig](#multicast) | UDP multicast receive settings. Required for a multicast feed. On a unicast type, this block is ignored. |
| `unicast` | [UnicastConfig](#unicast) | Unicast session settings. Required for a unicast feed. On a multicast type, this block is ignored. |

If no enabled multicast channel sets `reference: true`, the partition still starts, but there is no tier-2 or tier-3 recovery, and every channel's default `sloMode` is `DRIFT_ADJUSTED`. The first-enabled-channel fallback applies only to cross-channel drift and payload comparison.

## Multicast channels

Multicast feeds receive over UDP. Each channel carries a `multicast` block. Retransmit and snapshot settings for the feed are supplied with that feed's configuration.

### Multicast

YAML key: `channels[].multicast`

| Field | Type | Units | Description |
| --- | --- | --- | --- |
| `address` | String | — | IPv4 multicast group address (for example, `239.1.2.3`).
Mandatory: Yes for channels with [`enabled: true`](#channels) |
| `port` | Integer | — | UDP port.
Mandatory: Yes for channels with [`enabled: true`](#channels) |
| `networkInterface` | String | — | Local NIC name to bind (for example, `eth1`). If omitted, the OS default is used. |
| `receiveBufferSize` | Integer | bytes | OS-level `SO_RCVBUF`. Large values (for example, `8388608`) are recommended at line rate. |

Reception follows the channel-level [`enabled`](#channels) setting. Disable a channel there, not under `multicast`.

## Unicast channels

Unicast feeds receive over a point-to-point session. Use a single channel per partition with a `unicast` block. A `multicast` block on a unicast feed is ignored.

### Unicast

YAML key: `channels[].unicast`

| Field | Type | Units | Description |
| --- | --- | --- | --- |
| `enabled` | Boolean | — | Must be `true` for the unicast session to start. Omitted, `null`, or `false` prevents the market from starting.
Mandatory: Yes, and must be `true` |
| `hostname` | String | — | Unicast server hostname or IP.
Mandatory: Yes if enabled |
| `port` | Integer | — | Unicast server TCP port.
Mandatory: Yes if enabled |
| `username` | String | — | Log-in username (maximum 6 characters). Use [`${env:...}`](#credential-handling).
Mandatory: Yes if enabled |
| `password` | String | — | Log-in password (maximum 10 characters). Use [`${env:...}`](#credential-handling).
Mandatory: Yes if enabled |
| `connectTimeoutMs` | Integer | ms | TCP connect timeout.
Default: `5000` |
| `readTimeoutMs` | Integer | ms | Socket read timeout (including between server heartbeats).
Default: `30000` |
| `reconnectDelayMs` | Integer | ms | Initial delay before reconnecting after disconnect. Doubles on each failure up to `maxReconnectDelayMs`.
Default: `1000` |
| `maxReconnectDelayMs` | Integer | ms | Ceiling for reconnect backoff.
Default: `30000` |
| `startOfDaySequence` | Long | — | Sequence requested on the first (start-of-day) connect. Some exchanges expect `0`, others `1`. Midday reconnects resume from `lastSequence + 1`.
Default: `0` |
| `replayCatchUpMs` | Integer | ms | After every log-in, the server replays its backlog. The partition treats the feed as caught up at the first message that arrives within this many ms of its exchange time, or at the first server heartbeat. Until then, no latency is recorded for **Channels-Feeds** or **Search Latency**. Keep it above normal live latency and below the age of a replayed backlog. Must be positive.
Default: `1000` |

## Example configurations


**Important**


`<type>` stands for the value supplied for that feed. It selects the transport in the example. Do not copy `<type>` into a running config, and do not reuse a multicast type on a unicast feed, or the reverse.



### Complete configuration

The following example shows a full file with licensing, Geneos instrumentation, Status UI, search, and two multicast markets. Replace hostnames, multicast addresses, interfaces, and `type` values for your environment. Use [environment-variable substitution](#credential-handling) for credentials. Add the retransmit and snapshot settings supplied for each feed; those fields are not in this example.

```yaml
# Market Data Gateway configuration.

# Licence Daemon connection. For evaluation without licd, use demoMode: true instead.
licensing:
  host: localhost
  port: 7041
  # demoMode: true

instrumentation:
  geneos:
    enabled: true
    listenPort: 7036
    probeName: MDGatewayProbe
    managedEntity: md-gateway
    samplerName: MDGateway
    selfMonitoringIntervalMs: 20000
    marketDataIntervalMs: 2000
    # Rolling window (seconds) for rate columns.
    rateWindowSeconds: 60

    # TLS for the probe listen socket. Omit tlsConfig (or omit certFile) for plaintext.
    #tlsConfig:
    #  certFile: /path/to/md-gateway.crt
    #  keyFile: /path/to/md-gateway-key.pem
    #  # trustChainFile: /path/to/rootCA.pem
    #  # requireClientAuth: true
    #  minTlsVersion: "1.3"

    books:
      # OFF | TOP_N
      mode: TOP_N
      topN: 20

    searchCommands:
      enabled: false
      resultsDataviewName: Search-Results
      # exportDir: /var/lib/md-gateway/reports
      maxResultViews: 5
      queryTimeoutMs: 10000

# No authentication; listens on all interfaces. Leave enabled: false unless
# you need it for diagnostics, and firewall the port when you turn it on.
statusServer:
  enabled: true
  port: 8080
  snapshotIntervalMs: 500
  refreshIntervalMs: 1000

# Message search (optional — off by default when omitted or enabled: false).
search:
  enabled: true
  questdbDir: data/search
  minFreeDiskMb: 4096
  ringSizeBytes: 8388608
  retentionDays: 7
  tradingDayZone: UTC
  # webConsole: leave disabled for normal deployments

markets:
  - name: order-level
    type: "<type>"    # supplied value for this multicast order-level feed

    recovery:
      crossChannelBufferSize: 2048
      crossChannelWaitMs: 500
      retransmitThreshold: 1000
      retransmitTimeoutMs: 500
      maxRetransmitRetries: 3

    slo:
      latencyThresholdMs: 20
      latencyDescription: >-
        Percentage of messages with receive latency under threshold.
      lagDriftThresholdMs: 25
      leadDriftThresholdMs: 25
      driftDescription: >-
        Percentage of cross-channel comparisons where the receive-timestamp
        difference was under the drift threshold.
      shortWindowSeconds: 10
      longWindowSeconds: 300
      staleBookThresholdSeconds: 30

    partitions:
      - number: 1
        channels:
          - name: A
            enabled: true
            reference: true
            crossChannelFill: true
            driftMetrics: true
            sloMode: STRICT
            multicast:
              address: 239.1.2.3
              port: 5000
              networkInterface: eth0
          - name: B
            enabled: true
            reference: false
            crossChannelFill: true
            driftMetrics: true
            sloMode: DRIFT_ADJUSTED
            multicast:
              address: 239.1.2.4
              port: 5001
              networkInterface: eth0

  - name: price-level
    type: "<type>"    # supplied value for this multicast price-level feed
    partitions:
      - number: 1
        channels:
          - name: A
            enabled: true
            reference: true
            crossChannelFill: true
            driftMetrics: true
            sloMode: STRICT
            multicast:
              address: 239.1.2.5
              port: 5002
              networkInterface: eth0
          - name: B
            enabled: true
            reference: false
            crossChannelFill: true
            driftMetrics: true
            sloMode: DRIFT_ADJUSTED
            multicast:
              address: 239.1.2.6
              port: 5003
              networkInterface: eth0
```


