github.com/vmware/transport-go@v1.3.4/model/response.go (about)

     1  // Copyright 2019-2020 VMware, Inc.
     2  // SPDX-License-Identifier: BSD-2-Clause
     3  
     4  package model
     5  
     6  import (
     7  	"github.com/google/uuid"
     8  )
     9  
    10  // ResponseDir represents a payload sent by a Fabric application.
    11  type Response struct {
    12  	Id           *uuid.UUID  `json:"id"`
    13  	Created      string      `json:"created"`
    14  	Version      int         `json:"version"`
    15  	Destination  string      `json:"channel"`
    16  	Payload      interface{} `json:"payload"`
    17  	Error        bool        `json:"error"`
    18  	ErrorCode    int         `json:"errorCode"`
    19  	ErrorMessage string      `json:"errorMessage"`
    20  	// If populated the response will be send to a single client
    21  	// on the specified destination topic.
    22  	BrokerDestination *BrokerDestinationConfig `json:"-"`
    23  	Headers           map[string]string        `json:"headers"` // passthrough any http stuff.
    24  }
    25  
    26  // Used to specify the target user queue of the Response
    27  type BrokerDestinationConfig struct {
    28  	Destination  string
    29  	ConnectionId string
    30  }
    31  
    32  type ResponseHandlerFunction func(*Response)