Skip to content

Commit 4ddcde2

Browse files
committed
Freshness review, test, update
1 parent cd48816 commit 4ddcde2

File tree

1 file changed

+15
-10
lines changed

1 file changed

+15
-10
lines changed

articles/event-hubs/event-hubs-node-get-started-send.md

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,23 @@
11
---
2-
title: Send or receive events from Azure Event Hubs using JavaScript
2+
title: Send or receive events using JavaScript
33
description: This article provides a walkthrough for creating a JavaScript application that sends/receives events to/from Azure Event Hubs.
44
ms.topic: quickstart
5-
ms.date: 01/04/2023
5+
ms.date: 04/05/2024
66
ms.devlang: javascript
77
ms.custom: devx-track-js, mode-api, passwordless-js
8+
#customer intent: As a JavaScript developer, I want to learn how to send events to an event hub and receive events from the event hub using C#.
89
---
910

10-
# Send events to or receive events from event hubs by using JavaScript
11-
This quickstart shows how to send events to and receive events from an event hub using the **@azure/event-hubs** npm package.
11+
# Quickstart: Send events to or receive events from event hubs by using JavaScript
12+
In this Quickstart, you learn how to send events to and receive events from an event hub using the **@azure/event-hubs** npm package.
1213

1314

1415
## Prerequisites
1516
If you're new to Azure Event Hubs, see [Event Hubs overview](event-hubs-about.md) before you do this quickstart.
1617

1718
To complete this quickstart, you need the following prerequisites:
1819

19-
- **Microsoft Azure subscription**. To use Azure services, including Azure Event Hubs, you need a subscription. If you don't have an existing Azure account, you can sign up for a [free trial](https://azure.microsoft.com/free/) or use your MSDN subscriber benefits when you [create an account](https://azure.microsoft.com).
20+
- **Microsoft Azure subscription**. To use Azure services, including Azure Event Hubs, you need a subscription. If you don't have an existing Azure account, you can sign up for a [free trial](https://azure.microsoft.com/free/) or use your MSDN subscriber benefits when you [create an account](https://azure.microsoft.com).
2021
- Node.js LTS. Download the latest [long-term support (LTS) version](https://nodejs.org).
2122
- Visual Studio Code (recommended) or any other integrated development environment (IDE).
2223
- **Create an Event Hubs namespace and an event hub**. The first step is to use the [Azure portal](https://portal.azure.com) to create a namespace of type Event Hubs, and obtain the management credentials your application needs to communicate with the event hub. To create a namespace and an event hub, follow the procedure in [this article](event-hubs-create.md).
@@ -137,7 +138,7 @@ In this section, you create a JavaScript application that sends events to an eve
137138

138139
---
139140

140-
1. Run `node send.js` to execute this file. This command sends a batch of three events to your event hub.
141+
1. Run `node send.js` to execute this file. This command sends a batch of three events to your event hub. If you're using the Passwordless (Azure Active Directory's Role-based Access Control) authentication, you might want to run `az login` and sign into Azure using the account that was added to the Azure Event Hubs Data Owner role.
141142
1. In the Azure portal, verify that the event hub has received the messages. Refresh the page to update the chart. It might take a few seconds for it to show that the messages have been received.
142143

143144
[![Verify that the event hub received the messages](./media/node-get-started-send/verify-messages-portal.png)](./media/node-get-started-send/verify-messages-portal.png#lightbox)
@@ -169,7 +170,7 @@ To create an Azure storage account and a blob container in it, do the following
169170

170171
[Get the connection string to the storage account](../storage/common/storage-configure-connection-string.md).
171172

172-
Note the connection string and the container name. You'll use them in the receive code.
173+
Note the connection string and the container name. You use them in the receive code.
173174

174175
---
175176

@@ -350,18 +351,22 @@ npm install @azure/eventhubs-checkpointstore-blob
350351
351352
1. Run `node receive.js` in a command prompt to execute this file. The window should display messages about received events.
352353
353-
```
354+
```bash
354355
C:\Self Study\Event Hubs\JavaScript>node receive.js
355356
Received event: 'First event' from partition: '0' and consumer group: '$Default'
356357
Received event: 'Second event' from partition: '0' and consumer group: '$Default'
357358
Received event: 'Third event' from partition: '0' and consumer group: '$Default'
358359
```
360+
359361
> [!NOTE]
360362
> For the complete source code, including additional informational comments, go to the [GitHub receiveEventsUsingCheckpointStore.js page](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/eventhub/eventhubs-checkpointstore-blob/samples/v1/javascript/receiveEventsUsingCheckpointStore.js).
361363
362-
You have now received events from your event hub. The receiver program will receive events from all the partitions of the default consumer group in the event hub.
364+
You have now received events from your event hub. The receiver program receives events from all the partitions of the default consumer group in the event hub.
365+
366+
## Clean up resources
367+
Delete the resource group that has the Event Hubs namespace or delete only the namespace if you want to keep the resource group.
363368
364-
## Next steps
369+
## Related content
365370
Check out these samples on GitHub:
366371
367372
- [JavaScript samples](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/eventhub/event-hubs/samples/v5/javascript)

0 commit comments

Comments
 (0)