Skip to content

Commit ec99569

Browse files
feat(iota-graphql-rpc): Subscriptions support (#9365)
# Description of change This PR adds the GraphQL subscription support for `Events` and `Trnsactions`. Internally it leverages the `InMemory` broker from the new introduced `iota-indexer-streaming` crate in the monorepo. Currently this feature is only available for `devnet` & local networks, as the feature is still in alpha. ## Links to any relevant issues fixes #8784 ## How the change has been tested - ran graphql tests ```shell cargo nextest run -p iota-graphql-rpc --features pg_integration --no-fail-fast --test-threads 1 ``` - used the iota binary to spin up an indexer and graphql instance and test the subscription queries ``` cargo r --features indexer -- start --force-regenesis --with-indexer --with-graphql ``` - used the integrated graphiQL ui to issue subscription queries - used a third party graphql client (Postman) to issue the same queries - [x] Basic tests (linting, compilation, formatting, unit/integration tests) - [ ] Patch-specific tests (correctness, functionality coverage) ### Infrastructure QA (only required for crates that are maintained by @iotaledger/infrastructure) - [ ] Synchronization of the indexer from genesis for a network including migration objects. - [ ] Restart of indexer synchronization locally without resetting the database. - [ ] Restart of indexer synchronization on a production-like database. - [ ] Deployment of services using Docker. - [ ] Verification of API backward compatibility. > [!NOTE] > The following patch does not affect the normal operation of the indexer, thus tests were skipped. ### Release Notes - [x] Indexer: introduce to monorepo the `iota-indexer-streaming` crate which holds logic related to `iota-indexer` streaming capabilities for streaming `events` and `transactions`. - [x] GraphQL: Add `Subscription` support for `Event` and `TransactionBlock`. Currently this feature is only available for `devnet` & local networks, as the feature is still in alpha. --------- Co-authored-by: Marc Espin <mespinsanz@gmail.com>
1 parent 00f4a39 commit ec99569

File tree

27 files changed

+1840
-57
lines changed

27 files changed

+1840
-57
lines changed

.changeset/wet-deers-drum.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'@iota/graphql-transport': minor
3+
'@iota/iota-sdk': minor
4+
---
5+
6+
New subscription API types.

.github/crates-filters.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@ iota-indexer:
6666
- "crates/iota-indexer/**"
6767
iota-indexer-builder:
6868
- "crates/iota-indexer-builder/**"
69+
iota-indexer-streaming:
70+
- "crates/iota-indexer-streaming/**"
6971
iota-json:
7072
- "crates/iota-json/**"
7173
iota-json-rpc:

Cargo.lock

Lines changed: 135 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ members = [
9999
"crates/iota-http",
100100
"crates/iota-indexer",
101101
"crates/iota-indexer-builder",
102+
"crates/iota-indexer-streaming",
102103
"crates/iota-json",
103104
"crates/iota-json-rpc",
104105
"crates/iota-json-rpc-api",
@@ -419,6 +420,7 @@ iota-grpc-types = { path = "crates/iota-grpc-types" }
419420
iota-http = { path = "crates/iota-http" }
420421
iota-indexer = { path = "crates/iota-indexer" }
421422
iota-indexer-builder = { path = "crates/iota-indexer-builder" }
423+
iota-indexer-streaming = { path = "crates/iota-indexer-streaming" }
422424
iota-json = { path = "crates/iota-json" }
423425
iota-json-rpc = { path = "crates/iota-json-rpc" }
424426
iota-json-rpc-api = { path = "crates/iota-json-rpc-api" }

crates/iota-graphql-rpc/Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ tap.workspace = true
4141
tempfile.workspace = true
4242
thiserror.workspace = true
4343
tokio = { workspace = true, features = ["rt-multi-thread"] }
44+
tokio-stream.workspace = true
4445
tokio-util = { workspace = true, features = ["rt"] }
4546
toml.workspace = true
4647
tower.workspace = true
@@ -54,6 +55,7 @@ iota-graphql-config.workspace = true
5455
iota-graphql-rpc-client.workspace = true
5556
iota-graphql-rpc-headers.workspace = true
5657
iota-indexer.workspace = true
58+
iota-indexer-streaming.workspace = true
5759
iota-json.workspace = true
5860
iota-json-rpc.workspace = true
5961
iota-json-rpc-api.workspace = true

0 commit comments

Comments
 (0)