Portal Community

Reading the Response

// C# — server-side response handling
var response = await _publisher.PublishAndWaitAsync(request, ct);

// response.Outcome contains the type-specific outcome string
switch (response.Outcome)
{
    case "approved":
        await _workflow.ContinueWithApproval(
            correlationId: request.CorrelationId,
            approvedBy: response.RespondedBy,
            approvedAt: response.Timestamp,
            ct: ct);
        break;

    case "rejected":
        var comment = response.Data?["comment"]?.ToString();
        await _workflow.ContinueWithRejection(
            correlationId: request.CorrelationId,
            rejectedBy: response.RespondedBy,
            rejectionReason: comment,
            ct: ct);
        break;

    case "abstained":
        // Escalate to the next approver
        await _escalation.EscalateAsync(request, ct);
        break;
}

Typed Response Data

For typed response data (e.g., form submission data or selected picker IDs), deserialize response.Data:

// Picker response — selectedIds
if (response.Outcome == "selected")
{
    var pickerData = response.Data?.Deserialize<PickerResponseData>();
    var selectedIds = pickerData?.SelectedIds ?? Array.Empty<string>();
    await ProcessSelectedOptions(selectedIds, ct);
}

// Form response — all submitted field values
if (response.Outcome == "submitted")
{
    var formData = response.Data?.Deserialize<Dictionary<string, object>>();
    await ProcessFormSubmission(formData, ct);
}

Response Fields Reference

FieldTypeDescription
InteractionIdstringMatches the original request ID
RespondedBystringUser ID of the respondent — important for role-targeted interactions
OutcomestringType-specific outcome: approved, rejected, confirmed, submitted, selected, acknowledged
DataJsonElement?Type-specific data; null for simple outcomes
TimestampDateTimeOffsetWhen the user responded
SessionIdstringEdgeStream session ID of the responding session
CorrelationIdstring?Passed through from the request unchanged

Idempotent Response Processing

In distributed deployments, the same response may occasionally be delivered twice (EdgeStream at-least-once delivery). Protect your response handler with idempotency checks:

// Use interactionId as idempotency key
if (await _idempotencyStore.AlreadyProcessedAsync(response.InteractionId, ct))
{
    _logger.LogInformation("Duplicate response for {InteractionId} — ignoring", response.InteractionId);
    return;
}

await _idempotencyStore.MarkProcessedAsync(response.InteractionId, ct);
// ... process the response