Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions crates/node/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ const {
ScopeType,
deregisterSubscriber,
event,
flushSubscribers,
registerSubscriber,
withScope,
} = require("nemo-relay-node");
Expand All @@ -80,6 +81,7 @@ async function main() {
event("initialized", handle, { binding: "node" }, null);
});

flushSubscribers();
deregisterSubscriber("printer");
}

Expand Down
2 changes: 2 additions & 0 deletions crates/wasm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ const {
ScopeType,
deregisterSubscriber,
event,
flushSubscribers,
registerSubscriber,
withScope,
} = require("nemo-relay-wasm");
Expand All @@ -97,6 +98,7 @@ async function main() {
event("initialized", handle, { binding: "wasm" }, null);
});

flushSubscribers();
deregisterSubscriber("printer");
}

Expand Down
1 change: 1 addition & 0 deletions go/nemo_relay/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ func main() {
log.Fatal(err)
}
defer nemo.DeregisterSubscriber("printer")
defer nemo.FlushSubscribers()

handle, err := scope.Push("demo-agent", nemo.ScopeTypeAgent)
if err != nil {
Expand Down
5 changes: 5 additions & 0 deletions python/nemo_relay/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,13 @@ nemo_relay.subscribers.register("printer", on_event)
with nemo_relay.scope.scope("demo-agent", nemo_relay.ScopeType.Agent) as handle:
nemo_relay.scope.event("initialized", handle=handle, data={"binding": "python"})

nemo_relay.subscribers.flush()
nemo_relay.subscribers.deregister("printer")
```

Native subscriber delivery is asynchronous, so call
`nemo_relay.subscribers.flush()` before you read subscriber output or exit.

For host integrations that need a serialized event shape, consume the
canonical JSON payload from the subscriber event object:

Expand All @@ -164,6 +168,7 @@ try:
with nemo_relay.scope.scope("demo-agent", nemo_relay.ScopeType.Agent):
nemo_relay.scope.event("initialized", data={"binding": "python"})
finally:
nemo_relay.subscribers.flush()
nemo_relay.subscribers.deregister("host-exporter")
```

Expand Down
Loading