# README
Upstash QStash Go SDK
[!NOTE]
This project is in the Experimental Stage.We declare this project experimental to set clear expectations for your usage. There could be known or unknown bugs, the API could evolve, or the project could be discontinued if it does not find community adoption. While we cannot provide professional support for experimental projects, we’d be happy to hear from you if you see value in this project!
QStash is an HTTP based messaging and scheduling solution for serverless and edge runtimes.
Install
Use go get to install the Upstash QStash package:
go get github.com/upstash/qstash-go
Import the Upstash QStash package in your project:
import "github.com/upstash/qstash-go"
Usage
Publish a JSON message
client := qstash.NewClient("<QSTASH_TOKEN>")
// Error checking is omitted for breavity
res, _ := client.PublishJSON(qstash.PublishJSONOptions{
Url: "https://example.com",
Body: map[string]any{
"hello": "world",
},
Headers: map[string]string{
"test-header": "test-value",
},
})
fmt.Println(res.MessageId)
Create a scheduled message
client := qstash.NewClient("<QSTASH_TOKEN>")
scheduleId, err := client.Schedules().Create(qstash.ScheduleOptions{
Destination: "https://example.com",
Cron: "*/5 * * * *",
})
// handle err
fmt.Print(scheduleId)
Receiving messages
receiver := qstash.NewReceiver("<CURRENT_SIGNING_KEY>", "NEXT_SIGNING_KEY")
// ... in your request handler
signature := req.Header.Get("Upstash-Signature")
body, err := io.ReadAll(req.Body)
// handle err
err := receiver.Verify(qstash.VerifyOptions{
Signature: signature,
Body: string(body),
Url: "https://example.com", // optional
})
// handle err
Additional methods are available for managing url groups, schedules, and messages.
# Functions
NewClient initializes a client instance with the given token and the default HTTP client.
NewClientWith initializes a client with the given token and HTTP client.
NewClientWithEnv initializes a client with the token from the QSTASH_TOKEN environment variable and the default HTTP client.
No description provided by the author
No description provided by the author
No description provided by the author
# Variables
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
# Structs
No description provided by the author
No description provided by the author
No description provided by the author
Dlq (Dead Letter Queue) is a specialized queue used to store messages that cannot be processed successfully by the API.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
Queues in QStash are mechanisms that ensure ordered delivery (FIFO) and allow controlled parallelism in processing messages.
No description provided by the author
Receiver offers a simple way to verify the signature of a request.
No description provided by the author
No description provided by the author
No description provided by the author
Schedules in QStash allow you to publish messages at specified intervals instead of just once.
No description provided by the author
No description provided by the author
UrlGroups in QStash are namespaces where you can publish messages that are then sent to multiple endpoints.
No description provided by the author
# Type aliases
No description provided by the author