RedHatInsights / yggdrasil

GNU General Public License v3.0
21 stars 37 forks source link

Explicit HTTP request method "Request" #223

Open subpop opened 6 months ago

subpop commented 6 months ago

Add a new "com.redhat.Yggdrasil1.Dispatcher1.Request" D-Bus method. This method transmits data using an HTTP request. The existing "Transmit" method now exclusively transmits data over the configured transport (typically MQTT). Workers no longer need to set "RemoteContent" to true or false. A worker that previously relied on the "RemoteContent" feature will now receive the URL directly as the message body. It is the worker's responsibility to unpack the message body and get the URL. The "Request" method is available to provide an authenticated HTTP client to make HTTP requests easier, though a worker is not required to use it. Workers are free to choose either of the "Transmit" or the "Request" method to return data; they are no longer forced to use one method or the other.

jirihnidek commented 6 months ago

I also tried to test it with https server and it did not work. Let's try this:

echo '{"method": "GET", "url": "https://httpbin.org/get", "headers": {"User-Agent": "yggdrasil-http-worker"}}' | \
    go run ./cmd/yggctl generate data-message --directive http - | \
    pub -broker tcp://localhost:1883 -topic yggdrasil/$(hostname)/data/in