When should I use URL Groups?
URL Groups decouple your message producers from consumers by grouping one or more endpoints into a single namespace. Here’s an example: You have a serverless function which is invoked with each purchase in your e-commerce site. You want to send email to the customer after the purchase. Inside the function, you submit the URLapi/sendEmail
to the
QStash. Later, if you want to send a Slack notification, you need to update the
serverless function adding another call to QStash to submit
api/sendNotification
. In this example, you need to update and redeploy the
Serverless function at each time you change (or add) the endpoints.
If you create a URL Group product-purchase
and produce messages to that URL Group in
the function, then you can add or remove endpoints by only updating the URL Group.
URL Groups give you freedom to modify endpoints without touching the backend
implementation.
Check here to learn how to publish
to URL Groups.