Skip to content

Commit b6b8a1a

Browse files
committed
Add nats-jetstream package
Signed-off-by: Casper Beyer <[email protected]>
1 parent 2e13fe5 commit b6b8a1a

File tree

76 files changed

+10843
-1
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+10843
-1
lines changed

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ jobs:
5555
python-version: ["3.11", "3.12", "3.13"]
5656
os: ["ubuntu-latest", "macos-latest", "windows-latest"]
5757
nats-server-version: ["latest"]
58-
project: ["nats-server", "nats-client"]
58+
project: ["nats-server", "nats-client", "nats-jetstream"]
5959
steps:
6060
- name: Checkout repository
6161
uses: actions/checkout@v5

nats-jetstream/README.md

Whitespace-only changes.

nats-jetstream/pyproject.toml

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
[build-system]
2+
requires = ["hatchling"]
3+
build-backend = "hatchling.build"
4+
5+
[project]
6+
name = "nats-jetstream"
7+
version = "0.0.0"
8+
description = ''
9+
readme = "README.md"
10+
requires-python = ">=3.8"
11+
license = "MIT"
12+
keywords = []
13+
authors = [{ name = "Casper Beyer", email = "[email protected]" }]
14+
classifiers = [
15+
"Development Status :: 4 - Beta",
16+
"Programming Language :: Python",
17+
"Programming Language :: Python :: 3.8",
18+
"Programming Language :: Python :: 3.9",
19+
"Programming Language :: Python :: 3.10",
20+
"Programming Language :: Python :: 3.11",
21+
"Programming Language :: Python :: 3.12",
22+
"Programming Language :: Python :: Implementation :: CPython",
23+
"Programming Language :: Python :: Implementation :: PyPy",
24+
]
25+
dependencies = []
26+
27+
[project.urls]
28+
Documentation = "https://github.com/TODO/nats-core#readme"
29+
Issues = "https://github.com/TODO/nats-core/issues"
30+
Source = "https://github.com/TODO/nats-core"
31+
32+
[tool.hatch.metadata]
33+
allow-direct-references = true
34+
35+
[tool.hatch.build.targets.sdist]
36+
include = ["src/nats"]
37+
38+
[tool.hatch.build.targets.wheel]
39+
packages = ["src/nats"]
40+
41+
[tool.hatch.envs.hatch-test]
42+
dependencies = [
43+
"nats-client@ file:../nats-client",
44+
"nats-server @ file:../nats-server",
45+
]
46+
extra-dependencies = ["pytest-asyncio", "pytest-xdist"]
47+
48+
[tool.hatch.envs.default.scripts]
49+
test = "echo hello"
50+
51+
[tool.hatch.envs.types]
52+
extra-dependencies = ["mypy>=1.0.0"]
53+
54+
[tool.hatch.envs.types.scripts]
55+
check = "mypy --install-types --non-interactive {args:src/nats tests}"
56+
57+
[tool.coverage.run]
58+
source_pkgs = ["nats_core", "tests"]
59+
branch = true
60+
parallel = true
61+
omit = ["src/nats_core/__about__.py"]
62+
63+
[tool.coverage.paths]
64+
nats_core = ["src/nats_core", "*/nats-core/src/nats_core"]
65+
tests = ["tests", "*/nats-core/tests"]
66+
67+
[tool.coverage.report]
68+
exclude_lines = ["no cov", "if __name__ == .__main__.:", "if TYPE_CHECKING:"]
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-07/schema#",
3+
"$id": "https://nats.io/schemas/jetstream/api/v1/account_info_response.json",
4+
"description": "A response from the JetStream $JS.API.INFO API",
5+
"title": "io.nats.jetstream.api.v1.account_info_response",
6+
"type": "object",
7+
"required": [
8+
"type"
9+
],
10+
"oneOf": [
11+
{
12+
"$ref": "definitions.json#/definitions/account_stats"
13+
},
14+
{
15+
"$ref": "definitions.json#/definitions/error_response"
16+
}
17+
],
18+
"properties": {
19+
"type": {
20+
"type": "string",
21+
"const": "io.nats.jetstream.api.v1.account_info_response"
22+
}
23+
}
24+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-07/schema#",
3+
"$id": "https://nats.io/schemas/jetstream/api/v1/meta_account_purge_response.json",
4+
"description": "A response from the JetStream $JS.API.ACCOUNT.PURGE API",
5+
"title": "io.nats.jetstream.api.v1.account_purge_response",
6+
"type": "object",
7+
"oneOf": [
8+
{
9+
"$ref": "definitions.json#/definitions/error_response"
10+
},
11+
{
12+
"type": "object",
13+
"properties": {
14+
"initiated": {
15+
"type": "boolean",
16+
"description": "If the purge operation was successfully started",
17+
"default": false
18+
}
19+
}
20+
}
21+
],
22+
"properties": {
23+
"type": {
24+
"type": "string",
25+
"const": "io.nats.jetstream.api.v1.account_purge_response"
26+
}
27+
}
28+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-07/schema#",
3+
"$id": "https://nats.io/schemas/jetstream/api/v1/consumer_configuration.json",
4+
"description": "The data structure that describe the configuration of a NATS JetStream Consumer",
5+
"title": "io.nats.jetstream.api.v1.consumer_configuration",
6+
"type": "object",
7+
"$ref": "definitions.json#/definitions/consumer_configuration"
8+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-07/schema#",
3+
"$id": "https://nats.io/schemas/jetstream/api/v1/consumer_create_request.json",
4+
"description": "A request to the JetStream $JS.API.CONSUMER.CREATE API",
5+
"title": "io.nats.jetstream.api.v1.consumer_create_request",
6+
"type": "object",
7+
"required": [
8+
"stream_name",
9+
"config"
10+
],
11+
"properties": {
12+
"stream_name": {
13+
"type": "string",
14+
"description": "The name of the stream to create the consumer in"
15+
},
16+
"config": {
17+
"type": "object",
18+
"description": "The consumer configuration",
19+
"$ref": "definitions.json#/definitions/consumer_configuration"
20+
},
21+
"action": {
22+
"type": "string",
23+
"description": "The consumer create action"
24+
},
25+
"pedantic": {
26+
"type": "boolean",
27+
"description": "Enables pedantic mode where the server will not apply defaults or change the request",
28+
"default": false
29+
}
30+
}
31+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-07/schema#",
3+
"$id": "https://nats.io/schemas/jetstream/api/v1/consumer_create_response.json",
4+
"description": "A response from the JetStream $JS.API.CONSUMER.CREATE API",
5+
"title": "io.nats.jetstream.api.v1.consumer_create_response",
6+
"type": "object",
7+
"required": [
8+
"type"
9+
],
10+
"oneOf": [
11+
{
12+
"$ref": "definitions.json#/definitions/consumer_info"
13+
},
14+
{
15+
"$ref": "definitions.json#/definitions/error_response"
16+
}
17+
],
18+
"properties": {
19+
"type": {
20+
"type": "string",
21+
"const": "io.nats.jetstream.api.v1.consumer_create_response"
22+
}
23+
}
24+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-07/schema#",
3+
"$id": "https://nats.io/schemas/jetstream/api/v1/consumer_delete_response.json",
4+
"description": "A response from the JetStream $JS.API.CONSUMER.DELETE API",
5+
"title": "io.nats.jetstream.api.v1.consumer_delete_response",
6+
"type": "object",
7+
"required": [
8+
"type"
9+
],
10+
"oneOf": [
11+
{
12+
"$ref": "definitions.json#/definitions/error_response"
13+
},
14+
{
15+
"type": "object",
16+
"required": [
17+
"success"
18+
],
19+
"properties": {
20+
"success": {
21+
"type": "boolean"
22+
}
23+
}
24+
}
25+
],
26+
"properties": {
27+
"type": {
28+
"type": "string",
29+
"const": "io.nats.jetstream.api.v1.consumer_delete_response"
30+
}
31+
}
32+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-07/schema#",
3+
"$id": "https://nats.io/schemas/jetstream/api/v1/consumer_getnext_request.json",
4+
"description": "A request to the JetStream $JS.API.CONSUMER.MSG.NEXT API",
5+
"title": "io.nats.jetstream.api.v1.consumer_getnext_request",
6+
"type": "object",
7+
"properties": {
8+
"expires": {
9+
"$ref": "definitions.json#/definitions/golang_duration_nanos",
10+
"description": "A duration from now when the pull should expire, stated in nanoseconds, 0 for no expiry"
11+
},
12+
"batch": {
13+
"$ref": "definitions.json#/definitions/golang_int",
14+
"description": "How many messages the server should deliver to the requester",
15+
"minimum": 0,
16+
"maximum": 256
17+
},
18+
"max_bytes": {
19+
"$ref": "definitions.json#/definitions/golang_int",
20+
"description": "Sends at most this many bytes to the requester, limited by consumer configuration max_bytes",
21+
"minimum": 0
22+
},
23+
"no_wait": {
24+
"type": "boolean",
25+
"description": "When true a response with a 404 status header will be returned when no messages are available"
26+
},
27+
"idle_heartbeat": {
28+
"$ref": "definitions.json#/definitions/golang_duration_nanos",
29+
"description": "When not 0 idle heartbeats will be sent on this interval"
30+
}
31+
}
32+
}

0 commit comments

Comments
 (0)