From ee70ab18b0020b4902ed791746e2e91702ffb62a Mon Sep 17 00:00:00 2001 From: Lior Nabat Date: Thu, 25 Apr 2024 16:45:33 +0300 Subject: [PATCH] Add list functionality to various clients This commit introduces list functionality that fetches 'channels' from different clients such as EventsStoreClient, EventsClient, QueuesClient, QueriesClient, and CommandsClient. Each client is set-up with a configuration, and an asynchronous list function that queries and logs the 'channels'. --- examples/pubsub/events/list.ts | 18 ++++++++++++++++++ examples/pubsub/events_store/list.ts | 18 ++++++++++++++++++ examples/queues/list.ts | 18 ++++++++++++++++++ examples/rpc/commnds/list.ts | 18 ++++++++++++++++++ examples/rpc/queries/list.ts | 18 ++++++++++++++++++ 5 files changed, 90 insertions(+) create mode 100644 examples/pubsub/events/list.ts create mode 100644 examples/pubsub/events_store/list.ts create mode 100644 examples/queues/list.ts create mode 100644 examples/rpc/commnds/list.ts create mode 100644 examples/rpc/queries/list.ts diff --git a/examples/pubsub/events/list.ts b/examples/pubsub/events/list.ts new file mode 100644 index 0000000..3760ab3 --- /dev/null +++ b/examples/pubsub/events/list.ts @@ -0,0 +1,18 @@ +import { Config, Utils, EventsClient } from '../../../src'; + +const opts: Config = { + address: 'localhost:50000', + clientId: Utils.uuid(), + reconnectInterval: 1000, +}; +const eventsClient = new EventsClient(opts); +async function list(search: string) { + const channels = await eventsClient.list(search); + console.log(channels); +} + +async function main() { + await list('e1'); + // wait for receiver +} +main(); diff --git a/examples/pubsub/events_store/list.ts b/examples/pubsub/events_store/list.ts new file mode 100644 index 0000000..957c8d4 --- /dev/null +++ b/examples/pubsub/events_store/list.ts @@ -0,0 +1,18 @@ +import { Config, Utils, EventsStoreClient } from '../../../src'; + +const opts: Config = { + address: 'localhost:50000', + clientId: Utils.uuid(), + reconnectInterval: 1000, +}; +const eventsStoreClient = new EventsStoreClient(opts); +async function list(search: string) { + const channels = await eventsStoreClient.list(search); + console.log(channels); +} + +async function main() { + await list(''); + // wait for receiver +} +main(); diff --git a/examples/queues/list.ts b/examples/queues/list.ts new file mode 100644 index 0000000..5293a18 --- /dev/null +++ b/examples/queues/list.ts @@ -0,0 +1,18 @@ +import { Config, Utils, QueuesClient } from '../../src'; + +const opts: Config = { + address: 'localhost:50000', + clientId: Utils.uuid(), + reconnectInterval: 1000, +}; +const queuesClient = new QueuesClient(opts); +async function list(search: string) { + const channels = await queuesClient.list(search); + console.log(channels); +} + +async function main() { + await list(''); + // wait for receiver +} +main(); diff --git a/examples/rpc/commnds/list.ts b/examples/rpc/commnds/list.ts new file mode 100644 index 0000000..9bad481 --- /dev/null +++ b/examples/rpc/commnds/list.ts @@ -0,0 +1,18 @@ +import { Config, Utils, CommandsClient } from '../../../src'; + +const opts: Config = { + address: 'localhost:50000', + clientId: Utils.uuid(), + reconnectInterval: 1000, +}; +const commandsClient = new CommandsClient(opts); +async function list(search: string) { + const channels = await commandsClient.list(search); + console.log(channels); +} + +async function main() { + await list(''); + // wait for receiver +} +main(); diff --git a/examples/rpc/queries/list.ts b/examples/rpc/queries/list.ts new file mode 100644 index 0000000..1ce66e3 --- /dev/null +++ b/examples/rpc/queries/list.ts @@ -0,0 +1,18 @@ +import { Config, Utils, QueriesClient } from '../../../src'; + +const opts: Config = { + address: 'localhost:50000', + clientId: Utils.uuid(), + reconnectInterval: 1000, +}; +const queriesClient = new QueriesClient(opts); +async function list(search: string) { + const channels = await queriesClient.list(search); + console.log(channels); +} + +async function main() { + await list(''); + // wait for receiver +} +main();