Skip to content

Commit

Permalink
ADR-32: Adds a way to make queuegroup-less endpoints
Browse files Browse the repository at this point in the history
Signed-off-by: R.I.Pienaar <[email protected]>
  • Loading branch information
ripienaar committed Aug 8, 2024
1 parent 914d63e commit 166b802
Showing 1 changed file with 21 additions and 15 deletions.
36 changes: 21 additions & 15 deletions adr/ADR-32.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
# Service API

| Metadata | Value |
| -------- | ----------------- |
| Date | 2022-11-23 |
| Author | @aricart |
| Status | Implemented |
| Tags | client, spec |
| Metadata | Value |
|----------|--------------|
| Date | 2022-11-23 |
| Author | @aricart |
| Status | Implemented |
| Tags | client, spec |

## Release History

| Revision | Date | Description |
| -------- | ---------- | ------------------------ |
| 1 | 2022-11-23 | Initial release |
| 2 | 2023-09-12 | Configurable queue group |
| 3 | 2023-10-07 | Add version regex info |
| 4 | 2023-11-10 | Explicit naming |
| Revision | Date | Description |
|----------|------------|-------------------------------------------|
| 1 | 2022-11-23 | Initial release |
| 2 | 2023-09-12 | Configurable queue group |
| 3 | 2023-10-07 | Add version regex info |
| 4 | 2023-11-10 | Explicit naming |
| 5 | 2024-08-08 | Optional queue groups, immutable metadata |

## Context and Problem Statement

Expand All @@ -38,12 +39,14 @@ Service configuration relies on the following:
- `description` - a human-readable description about the service (optional)
- `metadata` - (optional) an object of strings holding free form metadata about
the deployed instance implemented consistently with
[Metadata for Stream and Consumer ADR-33](ADR-33.md).
[Metadata for Stream and Consumer ADR-33](ADR-33.md). Must be immutable once set.
- `statsHandler` - an optional function that returns unknown data that can be
serialized as JSON. The handler will be provided the endpoint for which it is
building a `EndpointStats`
- `queueGroup` - overrides a default queue group.

The `queueGroup` may not be empty.

All services are created using a function called `addService()` where the above
options are passed. The function returns an object/struct that represents the
service. At a minimum the service is expected to offer functions/methods that
Expand Down Expand Up @@ -291,15 +294,18 @@ Each service endpoint consists of the following fields:
Multiple endpoints can have the same names.
- `handler` - request handler - see [Request Handling](#Request-Handling)
- `metadata` - an optional `Record<string,string>` providing additional
information about the endpoint
information about the endpoint. Must be immutable once set.
- `subject` - an optional NATS subject on which the endpoint will be registered.
A subject is created by concatenating the subject provided by the user with
group prefix (if applicable). If subject is not provided, use `name` instead.
- `queueGroup` - optional override for a service and group `queueGroup`.

Enpoints can be created either on the service directly (`Service.addEndpoint()`)
Endpoints can be created either on the service directly (`Service.addEndpoint()`)
or on a group (`Group.addEndpoint`).

Clients should provide an idiomatic way to set no `queueGroup` when unset the subscription
for the endpoint will be a normal subscribe instead of a queue subscribe.

## Error Handling

Services may communicate request errors back to the client as they see fit, but
Expand Down

0 comments on commit 166b802

Please sign in to comment.