siilisolutions / hedge

a serverless solution for clojure
Eclipse Public License 1.0
39 stars 6 forks source link

Feature request : Function Outputs #84

Open erkkikeranen opened 6 years ago

erkkikeranen commented 6 years ago

While a HTTP triggered API is nice that returns a HTTP response, as a developer I would like to output some other stuff to db tables, queues, event hubs and what not automatically when I finish running of my function.

Similair to #83 (Function Inputs), we need an abstraction on outputs.

Ideas:

First solution:

hedge.edn

 :api {"api2h" {:handler my_cool_function.core/handler-to-queue 
                :authorization :anonymous
                :outputs [{:type :queue
                                  :key "out1"
                                  :name "queue2"
                                  :connection "AzureWebJobsStorage"}
                                 {:type :queue
                                  :key "out2"
                                  :name "queue2"
                                  :connection "AzureWebJobsStorage"}]

handler signature change example:

(defn handler [req & {:keys [outputs]}
    (reset! (-> outputs :out1) "this value goes to queue1")
    ; obviously out2 is not set and thus not processed
)

Notes:

Todo first solution: