# Connection

The following configuration items control how the TREP Adapter connects to RTDS and RTO (Real-Time — Optimized).

<dl><dt><strong>❗ IMPORTANT</strong></dt><dd>

Configure a connection to either RTDS or RTO -- not both.

Do not set [`upa-priority-groups`](trep-service.md#upa-priority-groups) if you have configured an RTO connection.
</dd></dl>

## RTO

To connect to RTO, use one of the methods below:

* Service endpoint discovery: [`rto-discovery-locations`](#rto-discovery-locations)
* Specific endpoint: [`rto-endpoint`](#rto-endpoint)

### rto-discovery-locations

A space-separated list of location names, which should be obtained from LSEG. These locations will be the most suitable for the geographic location of the deployed TREP Adapter.

When specifying multiple locations, you can separate locations by spaces or use multiple instances of `rto-discovery-locations` for each location.

**❗ IMPORTANT**\
If `[rto-endpoint](#rto-endpoint)` is configured then service discovery is not done.

**Type**: String array

**Syntax**: `rto-discovery-locations _location_ ...`

**Default**: _none_

**Previously**: `upa-rto-discovery-locations` (TREP Adapter 7.1.5)

**Since**: TREP Adapter 7.1.6

**A server deployed in Europe**

For a server deployed in Europe, the locations might be eu-west-1a and eu-west-1b:

**Single line configuration**

```
rto-discovery-locations eu-west-1a eu-west-1b
```

**Multiple line configuration**

```
rto-discovery-locations eu-west-1a
rto-discovery-locations eu-west-1b
```

**Service discovery**

If you configure `rto-discovery-locations` then the TREP Adapter performs service discovery to select an RTO endpoint.

Service discovery works as follows. Firstly, the TREP Adapter queries LSEG service discovery for a list of RTO endpoints that you are allowed to connect to. Once it has this list it will take the first configured `rto-discovery-locations` location and check the endpoint list for an entry that

* is in the current `rto-discovery-locations` location 
* has a failover endpoint

If it finds a match then that endpoint is selected and used for all channel connections and re-connections.

If no match is found then the list is checked again using the next `rto-discovery-locations` location and so on until an endpoint is found or all `rto-discovery-locations` locations have been checked.

If no endpoint is found in the list then the TREP Adapter exits.

### rto-endpoint

Specifies the URL of a single RTO endpoint. If you configure an `rto-endpoint` then no service discovery is attempted i.e. any [rto-discovery-locations](#rto-discovery-locations) configuration is ignored.

**❗ IMPORTANT**\
If `rto-endpoint` is configured then service discovery is disabled.

**Type**: String

**Syntax**: `rto-endpoint _url_`

**Default**: _none_

**Since**: TREP Adapter 7.1.5

**Example**:

```
rto-endpoint  tcps://eu-west-1-aws-3-sm.optimized-pricing-api.refinitiv.net:1400
```

### rto-scheme

Connection scheme for RTO

**Type**: String

**Syntax**: `rto-scheme _scheme_`

**RTO schemes**

| Scheme | Description |
| --- | --- |
| `tcp` | TCPS |
| `tcps` | Secure TCPS |
| `ws` | Web socket |
| `wss` | Secure Web socket |

**Default**: `tcps`

**Previously**: `upa-rto-scheme` (TREP Adapter 7.1.5)

**Since**: TREP Adapter 7.1.6

### rto-client-id

RTO client identifier

**Type**: String

**Syntax**: `rto-client-id _id_`

**Default**: _none_

**Previously**: `upa-client-id` (TREP Adapter 7.1.5)

**Since**: TREP Adapter 7.1.6

### rto-client-secret

RTO client secret for v2 authorisation.

<dl><dt><strong>❗ IMPORTANT</strong></dt><dd>

Only use this for v2 authorisation.
</dd></dl>

**Type**: String

**Syntax**: `rto-client-secret _secret_`

**Default**: _none_

**Since**: TREP Adapter 7.1.9

### rto-password

RTO password

**Type**: String

**Syntax**: `rto-password _password_`

**Default**: _none_

**Previously**: `upa-password` (TREP Adapter 7.1.5)

**Since**: TREP Adapter 7.1.6

### rto-username

RTO username for v1 authorisation.

If you are using v1 authorisation make sure that only `rto-username` is configured, don’t configure `[upa-username](#upa-username)`.

If you want to use v2 authorisation make sure that neither `rto-username` nor `[upa-username](#upa-username)` are configured.

**Type**: String

**Syntax**: `rto-username _username_`

**Default**: _none_

**Since**: TREP Adapter 7.1.6

## RTDS

To ensure that an RTDS connection is made make sure that neither `[rto-discovery-locations](#rto-discovery-locations)` nor `[rto-endpoint](#rto-endpoint)` is configured.

### upa-address

RTDS server hostname.

**Type**: String

**Default**: trep01

### upa-port

RTDS service name/port to connect to

**Type**: String

**Default**: 14002

### upa-username

RTDS username.

This configuration option is optional -- use it only if your RTDS endpoint requires a username.

Do not set both `upa-username` and [rto-username](#rto-username).

**Type**: String

**Default**: _none_
