UmweltDocs
Reference/Commands/transmitBatch
transmitBatchcommandsince 0.1

Several tellings in one transaction, such as a conversation.

Request
umwelt call story.umw transmitBatch '{
  "shared": { "projectId": "ball", "intent": "honest", "position": { "tick": 5 } },
  "transmits": [
    {
      "attemptId": "confide",
      "from": "bob",
      "to": "ana",
      "sourceRecordId": "bob-hid",
      "confidence": 1,
      "recordId": "ana-heard"
    },
    {
      "attemptId": "gossip",
      "from": "ana",
      "to": "maid",
      "sourceRecordId": "ana-saw",
      "confidence": 0.9,
      "recordId": "maid-heard"
    }
  ]
}'
Request
const result = await client.transmitBatch({
  shared: { projectId: 'ball', intent: 'honest', position: { tick: 5 } },
  transmits: [
    {
      attemptId: 'confide',
      from: 'bob',
      to: 'ana',
      sourceRecordId: 'bob-hid',
      confidence: 1,
      recordId: 'ana-heard',
    },
    {
      attemptId: 'gossip',
      from: 'ana',
      to: 'maid',
      sourceRecordId: 'ana-saw',
      confidence: 0.9,
      recordId: 'maid-heard',
    },
  ],
});
Request
var result = engine.TransmitBatch(new TransmitBatchPayload
{
    Shared = new TransmitShared
    {
        ProjectId = "ball",
        Intent = Intent.Honest,
        Position = new Position { Tick = 5 },
    },
    Transmits = new()
    {
        new TransmitBatchItem
        {
            AttemptId = "confide",
            From = "bob",
            To = "ana",
            SourceRecordId = "bob-hid",
            Confidence = 1,
            RecordId = "ana-heard",
        },
        new TransmitBatchItem
        {
            AttemptId = "gossip",
            From = "ana",
            To = "maid",
            SourceRecordId = "ana-saw",
            Confidence = 0.9,
            RecordId = "maid-heard",
        },
    },
});
Response
[
  {
    "eventId": "01a1cbd8-63e7-79a2-b499-79f2f92d2d0f",
    "recordIds": ["ana-heard"],
    "transitionIds": [],
    "version": 6,
    "warnings": [
      {
        "code": "SECRET_BREACH",
        "message": "'bob' told 'ana' the secret 'bob-hid'."
      }
    ]
  },
  {
    "eventId": "01a1cbd8-63e8-77c0-bd7b-9f83f9bfaff7",
    "recordIds": ["maid-heard"],
    "transitionIds": [],
    "version": 7,
    "warnings": []
  }
]

Payload

FieldTypeDescription
sharedTransmitSharedWhat the tellings have in common, written once: any of projectId, timelineId, position, on, from, to, sourceRecordId, intent, attitude and confidence.
transmitsrequiredTransmitBatchItem[]The tellings, in order, all on the same timeline. Each is a transmit payload that may leave to shared what it has in common with the others.

Result

A list of CommitOutcome, each with:

FieldTypeDescription
eventIdalwaysstringThe event written, with the id given or generated.
recordIdsalwaysstring[]The records written, in order.
transitionIdsalwaysstring[]The transitions written, in order.
versionalwaysintegerThe version this commit received. Reads at an earlier asOfVersion do not see it.
warningsWarning[]UNKNOWN_PREDICATE (open vocabulary) or SECRET_BREACH. Warnings never block a write.

Rules

One transaction. If one telling fails, none is written.

Nothing is assumed. A field given by a telling wins over shared. After the two are joined each telling must be complete: intent and confidence are still required, they can just be stated once. Only attitude has a default (believes).

The same attempt wherever a field is written. A retry that writes a field in the telling instead of in shared is recognized as the same request.

One timeline. Every telling of a batch must target the same timeline.

Errors

VALIDATION_FAILEDA telling is invalid or incomplete after shared is applied, shared carries a field that identifies one telling (attemptId, recordId, text, distortedClaim), or the tellings target different timelines.
NOT_FOUNDThe project, a holder, a source record or the timeline does not exist.
CONFLICTThe attemptId was already used with a different request.
INVALID_STATEThe timeline is a draft that was promoted or discarded, and accepts no more writes.
HANDSHAKE_REQUIREDOver the protocol, hello was not sent first.

Every code is listed in Errors.

See also

Was this page helpful?