diff --git a/examples/pubsub/README.md b/examples/pubsub/README.md index 71f168f4..c7668b2a 100644 --- a/examples/pubsub/README.md +++ b/examples/pubsub/README.md @@ -41,7 +41,12 @@ By default, the example uses HTTP. To use gRPC instead: daprPort: process.env.DAPR_GRPC_PORT, }, }); - const client = new DaprClient(daprHost, process.env.DAPR_GRPC_PORT, CommunicationProtocolEnum.GRPC); + + const client = new DaprClient({ + daprHost, + daprPort: process.env.DAPR_GRPC_PORT, + communicationProtocol: CommunicationProtocolEnum.GRPC, + }); ``` - To run: diff --git a/examples/pubsub/src/index.ts b/examples/pubsub/src/index.ts index 83ffd5fa..fa8cf998 100644 --- a/examples/pubsub/src/index.ts +++ b/examples/pubsub/src/index.ts @@ -38,7 +38,7 @@ async function start() { }); // Publish multiple messages to a topic with default config. - await server.pubsub.subscribeBulk("my-pubsub-component", "my-topic", async (data: Record) => { + await server.pubsub.subscribeBulk("my-pubsub-component", "my-topic-bulk", async (data: Record) => { // The library parses JSON when possible. console.log(`[Dapr-JS][Example] Received on subscription: ${JSON.stringify(data)}`); }); @@ -46,7 +46,7 @@ async function start() { // Publish multiple messages to a topic with specific maxMessagesCount and maxAwaitDurationMs. await server.pubsub.subscribeBulk( "my-pubsub-component", - "my-topic", + "my-topic-bulk-with-config", async (data: Record) => { // The library parses JSON when possible. console.log(`[Dapr-JS][Example] Received on subscription: ${JSON.stringify(data)}`); @@ -85,12 +85,12 @@ async function start() { console.log("[Dapr-JS][Example] Bulk publishing multiple plain messages"); const messages = ["message 1", "message 2", "message 3"]; - response = await client.pubsub.publishBulk("my-pubsub-component", "my-topic", messages); + response = await client.pubsub.publishBulk("my-pubsub-component", "my-topic-bulk", messages); console.log(`[Dapr-JS][Example] Bulk publish response: ${JSON.stringify(response)}`); console.log("[Dapr-JS][Example] Bulk publishing multiple JSON messages"); const jsonMessages = [{ hello: "message 1" }, { hello: "message 2" }, { hello: "message 3" }]; - response = await client.pubsub.publishBulk("my-pubsub-component", "my-topic", jsonMessages); + response = await client.pubsub.publishBulk("my-pubsub-component", "my-topic-bulk", jsonMessages); console.log(`[Dapr-JS][Example] Bulk publish response: ${JSON.stringify(response)}`); console.log("[Dapr-JS][Example] Bulk publishing with entryID and custom content type"); @@ -111,7 +111,7 @@ async function start() { event: "foo message 3", }, ]; - response = await client.pubsub.publishBulk("my-pubsub-component", "my-topic", bulkPublishMessages); + response = await client.pubsub.publishBulk("my-pubsub-component", "my-topic-bulk-with-config", bulkPublishMessages); console.log(`[Dapr-JS][Example] Bulk publish response: ${JSON.stringify(response)}`); }