From d24376c915a300e2930ff6bb5621c72600ee3b1c Mon Sep 17 00:00:00 2001 From: "Han Verstraete (OpenFaaS Ltd)" Date: Wed, 23 Aug 2023 11:11:19 +0200 Subject: [PATCH] Add Annotations field to QueueRequest - Add an annotations field to pass additional meta-date to the consumers of queue requests. - Add JSON attributes to struct. Signed-off-by: Han Verstraete (OpenFaaS Ltd) --- types/queue.go | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/types/queue.go b/types/queue.go index 0713887..f8e7c66 100644 --- a/types/queue.go +++ b/types/queue.go @@ -8,32 +8,36 @@ import ( // Request for asynchronous processing type QueueRequest struct { // Header from HTTP request - Header http.Header + Header http.Header `json:"Header,omitempty"` // Host from HTTP request - Host string + Host string `json:"Host,omitempty"` // Body from HTTP request to use for invocation - Body []byte + Body []byte `json:"Body,omitempty"` // Method from HTTP request - Method string + Method string `json:"Method"` // Path from HTTP request - Path string + Path string `json:"Path,omitempty"` // QueryString from HTTP request - QueryString string + QueryString string `json:"QueryString,omitempty"` // Function name to invoke - Function string + Function string `json:"Function"` // QueueName to publish the request to, leave blank // for default. - QueueName string + QueueName string `json:"QueueName,omitempty"` + + // Annotations defines a collection of meta-data that can be used by + // the queue worker when processing the queued request. + Annotations map[string]string `json:"Annotations,omitempty"` // Used by queue worker to submit a result - CallbackURL *url.URL `json:"CallbackUrl"` + CallbackURL *url.URL `json:"CallbackUrl,omitempty"` } // RequestQueuer can public a request to be executed asynchronously