Workload communication guide (preview)

This article describes how the communication between Frontend and Backend works and what needs to be taken into account.

Frontend-Backend communication

Authentication between your Frontend and the backend happens over a secure and authenticated channel. To have a token available in your Backend that, you can use to communicate with other services, you can use the Fabric Frontend to pass the communication to the Backend.

Error handling

To propagate any errors that occur in the workload backend to the workload frontend when working with control plane APIs (CRUD/Jobs except for GetItemJobInstanceStateAsync), the workload backend should return an error status code and the response body content should be a serialized JSON of the class ErrorResponse that is a part of the contracts in the workload backend.

    var errorResponse = new ErrorResponse
    {
        ErrorCode = ErrorCode,
        Message = ErrorMessage,
        MessageParameters = _messageParameters.Any() ? _messageParameters : null,
        Source = ErrorSource,
        IsPermanent = IsPermanent,
        MoreDetails = Details,
    };
    
    
    return new ContentResult
    {
        StatusCode = (int)HttpStatusCode,
        Content = JsonSerializer.Serialize(errorResponse),
        ContentType = MediaTypeNames.Application.Json,
    };