receiveFromRelay

Reads records from a relay flow on another Connect instance. The relay flow serves the records through relayApi. The receiving flow opens the connections, so it can read records without accepting incoming connections.

The flow source fetches batches of records from the relay flow. Each record starts a separate message, so the receiving flow’s processors see one record per message, not the whole batch.

Configure the receiving flow

Set exchangePattern = RequestResponse and deliveryGuarantee = BySourceSystem. In receiveFromRelay, set address to the relay flow URL without /relay/v1, and choose a nackStrategy for records that still fail after retries. If the relay flow requires authentication, use authenticationConfigKey for HTTP credentials or sslAuthenticationConfigKey for a TLS client certificate. Grant Flow Access on the receiving flow to a local Poller User service account.

Message payload

The message payload is just the record’s value as a string, or null if the record has no value. The flow source does not parse JSON or decode Base64. If the relay sends JSON text, for example {"crewId":"crew-4711","status":"EnRoute"}, you can forward that text as-is or parse it in the processor that needs to read its fields using inboundTransformationStrategy { fromJsonText().toJsonCompliant() }. If the relay sends a Base64 value, use fromBase64 before a processor that needs the original bytes.

Examples

Forward each JSON record to an HTTP endpoint without changing it:

flowConfig {
    id = "crew-updates-poller"
    ownerId = "my-owner"
    exchangePattern = RequestResponse
    deliveryGuarantee = BySourceSystem

    receiveFromRelay {
        id = "crew-updates-source"
        address = "https://relay.example.com/cloud-owner/rs/crew-updates-relay"
        authenticationConfigKey = "cloudConnect"
        nackStrategy = RelayNackStrategy.PAUSE
    }

    restRequest {
        id = "update-crew"
        defaultMethod = POST
        address = "https://adms-crew.example.com/api/crew/UpdateCrew"
        defaultEntityContentType = "application/json"
    }
}

Decode each Base64 record before sending its bytes to an HTTP endpoint:

flowConfig {
    id = "binary-events-poller"
    ownerId = "my-owner"
    exchangePattern = RequestResponse
    deliveryGuarantee = BySourceSystem

    receiveFromRelay {
        id = "binary-events-source"
        address = "https://relay.example.com/cloud-owner/rs/binary-events-relay"
        authenticationConfigKey = "cloudConnect"
        nackStrategy = RelayNackStrategy.PAUSE
    }

    fromBase64 { id = "decode-event" }

    restRequest {
        id = "send-event"
        defaultMethod = POST
        address = "https://events.example.com/api/events"
        defaultEntityContentType = "application/octet-stream"
    }
}

Acknowledgements and failures

The flow source acknowledges progress to the relay in fetch order. A later record can finish before an earlier one, but the acknowledgement cannot move past the earlier record until it too is complete. When the flow reports a failure (a negative acknowledgement, or NACK), the flow source retries the record without fetching it again. If the record still fails after nackMaxRetries retries, nackStrategy decides what happens:

  • SKIP treats the failed record as complete so acknowledgements can move past it. Use it only if the flow can continue without successfully delivering that record.

  • PAUSE keeps retrying the record. It stops starting more records with the same ordering key until that record succeeds. Records with other keys can still run. The acknowledgement stays at the last completed position before the failure, even if those other records succeed.

Unacknowledged records can be delivered again after a restart. If duplicate updates would cause a problem, use a stable event ID from the record to recognize repeats.

Ordering and timing

STRICT, the default orderingStrategy, starts one record at a time for each ordering key supplied by the relay. For a Kafka relay, this groups records by Kafka partition. CONCURRENT lets records from the same group run at the same time, up to the flow’s maxNumberOfInFlightMessages limit.

STRICT controls when the flow starts records. It cannot undo an HTTP call that is still running at the target after Connect times it out. For example, a crew update may time out, succeed on retry, then the original call may complete after a newer update. Set redeliveryMillis above the longest expected processing time for one attempt, with room for the target to respond. If updates must take effect in order even after a timeout, have the target reject stale updates using a sequence number or version.

Exchange properties

The flow source adds this metadata for processors that need it. You do not set it, send it back to the relay, or preserve it for acknowledgements to work. Keep a property if a later processor needs it.

  • relayKey: the record key, when present.

  • relayAttributes: a JSON array of {name, value} objects, preserving repeated names and their order.

  • relayTimestamp: the record timestamp in milliseconds since the epoch.

  • relayCursor: the position after this record, for tracing progress. It can change when a record is delivered again, so do not use it as a deduplication key.

Relay API

The flow source appends /relay/v1 to address and makes the following requests automatically. The receiving flow does not need to build requests or unpack responses.

Fetch

POST /relay/v1/fetch:

{"pollerId":"poller-1","ack":"v1.A","cursor":"v1.B","maxRecords":100,"waitMillis":20000}

pollerId identifies this source instance. ack is the optional acknowledgement up to which records are complete. cursor is the optional read position; when omitted, it uses ack, or the relay’s committed position if neither is supplied. If no position has been committed, the relay uses its start policy. The flow source requests maxRecords and waitMillis from its configuration. If omitted on the wire, the relay uses its own limits (100 records and 0 milliseconds by default). maxRecords: 0 renews the lease without requesting records.

{
  "records": [
    {
      "key": "crew-4711",
      "payload": "EnRoute",
      "attributes": [
        {
          "name": "type",
          "value": "status"
        }
      ],
      "timestamp": 1762934400000,
      "orderingKey": "0",
      "cursor": "v1.C"
    }
  ],
  "payloadEncoding": "TEXT",
  "nextCursor": "v1.D",
  "hasMore": false,
  "gaps": [],
  "lease": {
    "pollerId": "poller-1",
    "epoch": 8,
    "ttlMillis": 60000
  }
}

The response contains the records, possibly empty, and their payloadEncoding ( TEXT or BASE64, also used for keys and attribute values). A record’s key and payload can be null; attributes default to an empty list. Each record requires its timestamp in epoch milliseconds. orderingKey groups records that must be dispatched in order, and cursor marks the position just after the record. nextCursor marks the end of the batch. hasMore defaults to false; gaps defaults to an empty list. Each gap’s lostRecords is an upper bound on the records removed by retention. The lease gives its holder, epoch, and lifetime in milliseconds after the response.

Release

POST /relay/v1/release:

{"pollerId":"poller-1","ack":"v1.D"}

On graceful stop, the source sends its pollerId and final ack, if it has one. The relay replies with 204 No Content; the source accepts any 2xx status and ignores the body.

Properties

Name Summary

address

The relay flow URL, without /relay/v1.

nackStrategy

Required. SKIP continues past an exhausted record; PAUSE pauses its ordering key and keeps retrying.

orderingStrategy

Defaults to STRICT: one record at a time per ordering key. CONCURRENT allows overlapping dispatches.

maxRecords

The maximum records requested per fetch, from 1 to 1000. Defaults to 100. The relay may cap it further.

waitMillis

How long to wait for records, in milliseconds. Defaults to 20,000. The relay may cap it further.

receiveTimeoutMillis

How long to wait for response bytes, in milliseconds. Defaults to 30,000. Must exceed waitMillis.

connectionTimeoutMillis

How long to wait to establish a connection, in milliseconds. Defaults to the restRequest server setting.

authenticationConfigKey

Key for the relay flow’s HTTP authentication credentials.

sslAuthenticationConfigKey

Key for TLS credentials and trust configuration.

proxyHost

Optional HTTP proxy host. Set proxyPort as well.

proxyPort

Optional HTTP proxy port. Set proxyHost as well.

proxyAuthenticationConfigKey

Key for the HTTP proxy’s username and password.

nackMaxRetries

How many times to redeliver a failed record before applying nackStrategy. Defaults to 3.

nackRetryDelayMillis

How long to wait before redelivering a failed record, in milliseconds. Defaults to 30,000.

spreadKey

Placement key for the singleton source.

name

Optional, descriptive name for the processor.

id

Required identifier of the processor, unique across all processors within the flow. Must be between 3 and 30 characters long; contain only lower and uppercase alphabetical characters (a-z and A-Z), numbers, dashes ("-"), and underscores ("_"); and start with an alphabetical character. In other words, it adheres to the regex pattern [a-zA-Z][a-zA-Z0-9_-]{2,29}.

exchangeProperties

Optional set of custom properties in a simple jdk-format, that are added to the message exchange properties before processing the incoming payload. Any existing properties with the same name will be replaced by properties defined here.

Sub-builders

Name Summary

messageLoggingStrategy

Strategy for describing how a processor’s message is logged on the server.

payloadArchivingStrategy

Strategy for archiving payloads.