From 859fc2181f267715a578633e22a82a5182ed27dc Mon Sep 17 00:00:00 2001 From: ramya0820 <45977823+ramya0820@users.noreply.github.com> Date: Fri, 2 Aug 2019 15:41:22 -0700 Subject: [PATCH] [Event Hubs] Add test for exceeding max listeners on send (#4637) --- sdk/eventhub/event-hubs/src/eventHubSender.ts | 2 +- sdk/eventhub/event-hubs/test/sender.spec.ts | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/sdk/eventhub/event-hubs/src/eventHubSender.ts b/sdk/eventhub/event-hubs/src/eventHubSender.ts index b149d68e4334..ccde32d6e311 100644 --- a/sdk/eventhub/event-hubs/src/eventHubSender.ts +++ b/sdk/eventhub/event-hubs/src/eventHubSender.ts @@ -644,7 +644,7 @@ export class EventHubSender extends LinkEntity { ); return resolve(); } catch (err) { - err = translate(err); + err = translate(err.innerError || err); log.error( "[%s] An error occurred while sending the message", this._context.connectionId, diff --git a/sdk/eventhub/event-hubs/test/sender.spec.ts b/sdk/eventhub/event-hubs/test/sender.spec.ts index 1bc1c72a9530..382970365a1c 100644 --- a/sdk/eventhub/event-hubs/test/sender.spec.ts +++ b/sdk/eventhub/event-hubs/test/sender.spec.ts @@ -355,6 +355,24 @@ describe("EventHub Sender #RunnableInBrowser", function(): void { } await Promise.all(promises); }); + + it("should be sent successfully in parallel, even when exceeding max event listener count of 1000", async function(): Promise< + void + > { + const senderCount = 1200; + try { + const producer = client.createProducer(); + const promises = []; + for (let i = 0; i < senderCount; i++) { + promises.push(producer.send([{ body: `Hello World ${i}` }])); + } + await Promise.all(promises); + } catch (err) { + debug("An error occurred while running the test: ", err); + throw err; + } + }); + it("should be sent successfully in parallel by multiple senders", async function(): Promise< void > {