Skip to content

Commit 1873d10

Browse files
committed
validation warning fixes
1 parent 73d7338 commit 1873d10

File tree

2 files changed

+61
-61
lines changed

2 files changed

+61
-61
lines changed

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

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ ms.author: spelluru
1212

1313
---
1414

15-
# Send events to or receive events from Azure Event Hubs using Node.js
15+
# Send events to or receive events from Azure Event Hubs using Node.js
1616

1717
Azure Event Hubs is a Big Data streaming platform and event ingestion service that can receive and process millions of events per second. Event Hubs can process and store events, data, or telemetry produced by distributed software and devices. Data sent to an event hub can be transformed and stored using any real-time analytics provider or batching/storage adapters. For detailed overview of Event Hubs, see [Event Hubs overview](event-hubs-about.md) and [Event Hubs features](event-hubs-features.md).
1818

@@ -51,104 +51,104 @@ npm install @azure/eventhubs-checkpointstore-blob
5151

5252
## Send events
5353

54-
This section shows you how to create a Node.js application that sends events to an event hub.
54+
This section shows you how to create a Node.js application that sends events to an event hub.
5555

56-
1. Open your favorite editor, such as [Visual Studio Code](https://code.visualstudio.com).
57-
2. Create a file called `send.js` and paste the following code into it.
56+
1. Open your favorite editor, such as [Visual Studio Code](https://code.visualstudio.com).
57+
2. Create a file called `send.js` and paste the following code into it.
5858

5959
```javascript
6060
const { EventHubProducerClient } = require("@azure/event-hubs");
61-
61+
6262
const connectionString = "EVENT HUBS NAMESPACE CONNECTION STRING";
6363
const eventHubName = "EVENT HUB NAME";
6464

6565
async function main() {
66-
66+
6767
// create a producer client to send messages to the event hub
6868
const producer = new EventHubProducerClient(connectionString, eventHubName);
69-
69+
7070
// prepare a batch of three events
7171
const batch = await producer.createBatch();
7272
batch.tryAdd({ body: "First event" });
7373
batch.tryAdd({ body: "Second event" });
7474
batch.tryAdd({ body: "Third event" });
75-
75+
7676
// send the batch to the event hub
7777
await producer.sendBatch(batch);
78-
78+
7979
// close the producer client
8080
await producer.close();
81-
81+
8282
console.log("A batch of three events have been sent to the event hub");
8383
}
8484

8585
main().catch((err) => {
8686
console.log("Error occurred: ", err);
8787
});
8888
```
89-
3. Don't forget to replace the **connection string** and the **event hub name** values in the code.
89+
3. Don't forget to replace the **connection string** and the **event hub name** values in the code.
9090
5. Run the command `node send.js` to execute this file. This will send a batch of three events to your event hub
91-
6. In the Azure portal, you can verify that the event hub has received the messages. Switch to **Messages** view in the **Metrics** section. Refresh the page to update the chart. It may take a few seconds for it to show that the messages have been received.
91+
6. In the Azure portal, you can verify that the event hub has received the messages. Switch to **Messages** view in the **Metrics** section. Refresh the page to update the chart. It may take a few seconds for it to show that the messages have been received.
9292
9393
[![Verify that the event hub received the messages](./media/getstarted-dotnet-standard-send-v2/verify-messages-portal.png)](./media/getstarted-dotnet-standard-send-v2/verify-messages-portal.png#lightbox)
9494
9595
> [!NOTE]
9696
> For the complete source code with more informational comments, see [this file on the GitHub](https://github.com/Azure/azure-sdk-for-js/blob/master/sdk/eventhub/event-hubs/samples/javascript/sendEvents.js)
9797
98-
Congratulations! You have now sent events to an event hub.
98+
Congratulations! You have now sent events to an event hub.
9999
100100
101-
## Receive events
101+
## Receive events
102102
This section shows how to receive events from an event hub by using an Azure Blob checkpoint store in a Node.js application. It checkpoints metadata on received messages at regular intervals in an Azure Storage Blob. This approach makes it easy to continue receiving messages from where you left off at a later time.
103103
104104
### Create an Azure Storage and a blob container
105-
Follow these steps to create an Azure Storage account a blob container in it.
105+
Follow these steps to create an Azure Storage account a blob container in it.
106106
107-
1. [Create an Azure Storage account](../storage/common/storage-quickstart-create-account.md?tabs=azure-portal)
107+
1. [Create an Azure Storage account](../storage/common/storage-account-create.md?tabs=azure-portal)
108108
2. [Create a blob container](../storage/blobs/storage-quickstart-blobs-portal.md#create-a-container)
109109
3. [Get the connection string to the storage account](../storage/common/storage-configure-connection-string.md?#view-and-copy-a-connection-string)
110110
111-
Note down connection string and the container name. You will use them in the receive code.
111+
Note down connection string and the container name. You will use them in the receive code.
112112
113113
### Write code to receive events
114114
115-
1. Open your favorite editor, such as [Visual Studio Code](https://code.visualstudio.com).
116-
2. Create a file called `receive.js` and paste the following code into it. See code comments for details.
115+
1. Open your favorite editor, such as [Visual Studio Code](https://code.visualstudio.com).
116+
2. Create a file called `receive.js` and paste the following code into it. See code comments for details.
117117
```javascript
118118
const { EventHubConsumerClient } = require("@azure/event-hubs");
119119
const { ContainerClient } = require("@azure/storage-blob");
120120
const { BlobCheckpointStore } = require("@azure/eventhubs-checkpointstore-blob");
121-
121+
122122
const connectionString = "EVENT HUBS NAMESPACE CONNECTION STRING";
123123
const eventHubName = "EVENT HUB NAME";
124124
const consumerGroup = "$Default"; // name of the default consumer group
125125
const storageConnectionString = "AZURE STORAGE CONNECTION STRING";
126126
const containerName = "BLOB CONTAINER NAME";
127-
127+
128128
async function main() {
129129
// create a blob container client and a blob checkpoint store using the client
130130
const containerClient = new ContainerClient(storageConnectionString, containerName);
131131
const checkpointStore = new BlobCheckpointStore(containerClient);
132-
132+
133133
// create a consumer client for the event hub by specifying the checkpoint store
134134
const consumerClient = new EventHubConsumerClient(consumerGroup, connectionString, eventHubName, checkpointStore);
135-
136-
// subscribe for the events and specify handlers for processing the events and errors.
135+
136+
// subscribe for the events and specify handlers for processing the events and errors.
137137
const subscription = consumerClient.subscribe({
138138
processEvents: async (events, context) => {
139139
for (const event of events) {
140140
console.log(`Received event: '${event.body}' from partition: '${context.partitionId}' and consumer group: '${context.consumerGroup}'`);
141141
}
142-
// update the checkpoint
142+
// update the checkpoint
143143
await context.updateCheckpoint(events[events.length - 1]);
144144
},
145-
145+
146146
processError: async (err, context) => {
147147
console.log(`Error : ${err}`);
148148
}
149149
}
150150
);
151-
151+
152152
// after 30 seconds, stop processing
153153
await new Promise((resolve) => {
154154
setTimeout(async () => {
@@ -158,17 +158,17 @@ Follow these steps to create an Azure Storage account a blob container in it.
158158
}, 30000);
159159
});
160160
}
161-
161+
162162
main().catch((err) => {
163163
console.log("Error occurred: ", err);
164164
});
165165
```
166-
3. Don't forget to specify the **following values** in the code:
166+
3. Don't forget to specify the **following values** in the code:
167167
- Connection string to the Event Hubs namespace
168168
- Name of the event hub
169169
- Connection string to the Azure Storage account
170170
- Name of the blob container
171-
5. Then run the command `node receive.js` in a command prompt to execute this file. You should see the messages about received events in the window.
171+
5. Then run the command `node receive.js` in a command prompt to execute this file. You should see the messages about received events in the window.
172172

173173
> [!NOTE]
174174
> For the complete source code with more informational comments, see [this file on the GitHub](https://github.com/Azure/azure-sdk-for-js/blob/master/sdk/eventhub/eventhubs-checkpointstore-blob/samples/receiveEventsUsingCheckpointStore.js).
@@ -179,4 +179,4 @@ Congratulations! You have now received events from event hub. The receiver progr
179179
Check out these samples on GitHub:
180180

181181
- [JavaScript samples](https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/eventhub/event-hubs/samples/javascript)
182-
- [TypeScript samples](https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/eventhub/event-hubs/samples/typescript)
182+
- [TypeScript samples](https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/eventhub/event-hubs/samples/typescript)

articles/event-hubs/get-started-python-send-v2.md

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ ms.author: spelluru
1616

1717
Azure Event Hubs is a Big Data streaming platform and event ingestion service, capable of receiving and processing millions of events per second. Event Hubs can process and store events, data, or telemetry produced by distributed software and devices. Data sent to an event hub can be transformed and stored using any real-time analytics provider or batching/storage adapters. For detailed overview of Event Hubs, see [Event Hubs overview](event-hubs-about.md) and [Event Hubs features](event-hubs-features.md).
1818

19-
This tutorial describes how to create Python applications to send events to or receive events from an event hub.
19+
This tutorial describes how to create Python applications to send events to or receive events from an event hub.
2020

2121
> [!IMPORTANT]
2222
> This quickstart uses version 5 of the Azure Event Hubs Python SDK. For a quick start that uses the old version 1 of the Python SDK, see [this article](event-hubs-python-get-started-send.md). If you are using version 1 of the SDK, we recommend that you migrate your code to the latest version. For details, see the [migration guide](https://github.com/Azure/azure-sdk-for-python/blob/master/sdk/eventhub/azure-eventhub/migration_guide.md).
@@ -27,53 +27,53 @@ This tutorial describes how to create Python applications to send events to or r
2727
To complete this tutorial, you need the following prerequisites:
2828

2929
- An Azure subscription. If you don't have one, [create a free account](https://azure.microsoft.com/free/) before you begin.
30-
- An active Event Hubs namespace and event hub, created by following the instructions at [Quickstart: Create an event hub using Azure portal](event-hubs-create.md). Make a note of the namespace and event hub names to use later in this walkthrough.
31-
- The shared access key name and primary key value for your Event Hubs namespace. Get the access key name and value by following the instructions at [Get connection string](event-hubs-get-connection-string.md#get-connection-string-from-the-portal). The default access key name is **RootManageSharedAccessKey**. Copy the key name and the primary key value to use later in this walkthrough.
30+
- An active Event Hubs namespace and event hub, created by following the instructions at [Quickstart: Create an event hub using Azure portal](event-hubs-create.md). Make a note of the namespace and event hub names to use later in this walkthrough.
31+
- The shared access key name and primary key value for your Event Hubs namespace. Get the access key name and value by following the instructions at [Get connection string](event-hubs-get-connection-string.md#get-connection-string-from-the-portal). The default access key name is **RootManageSharedAccessKey**. Copy the key name and the primary key value to use later in this walkthrough.
3232
- Python 2.7, and 3.5 or later, with `pip` installed and updated.
33-
- The Python package for Event Hubs. To install the package, run this command in a command prompt that has Python in its path:
34-
33+
- The Python package for Event Hubs. To install the package, run this command in a command prompt that has Python in its path:
34+
3535
```cmd
3636
pip install azure-eventhub
3737
```
3838
39-
Install this package for receiving the events using an Azure Blob storage as the checkpoint store.
39+
Install this package for receiving the events using an Azure Blob storage as the checkpoint store.
4040
4141
```cmd
4242
pip install azure-eventhub-checkpointstoreblobaio
4343
```
4444
4545
## Send events
46-
In this section, you create a Python script to send events to the event hub you created earlier.
46+
In this section, you create a Python script to send events to the event hub you created earlier.
4747
4848
1. Open your favorite Python editor, such as [Visual Studio Code](https://code.visualstudio.com/)
49-
2. Create a script called **send.py**. This script sends a batch of events to the event hub you created earlier.
50-
3. Paste the following code into send.py. See the code comments for details.
49+
2. Create a script called **send.py**. This script sends a batch of events to the event hub you created earlier.
50+
3. Paste the following code into send.py. See the code comments for details.
5151
5252
```python
5353
import asyncio
5454
from azure.eventhub.aio import EventHubProducerClient
5555
from azure.eventhub import EventData
56-
56+
5757
async def run():
5858
# create a producer client to send messages to the event hub
59-
# specify connection string to your event hubs namespace and
59+
# specify connection string to your event hubs namespace and
6060
# the event hub name
6161
producer = EventHubProducerClient.from_connection_string(conn_str="EVENT HUBS NAMESPACE - CONNECTION STRING", eventhub_name="EVENT HUB NAME")
6262
async with producer:
6363
# create a batch
6464
event_data_batch = await producer.create_batch()
65-
65+
6666
# add events to the batch
6767
event_data_batch.add(EventData('First event '))
6868
event_data_batch.add(EventData('Second event'))
6969
event_data_batch.add(EventData('Third event'))
70-
70+
7171
# send the batch of events to the event hub
7272
await producer.send_batch(event_data_batch)
73-
73+
7474
loop = asyncio.get_event_loop()
7575
loop.run_until_complete(run())
76-
76+
7777
```
7878
7979
> [!NOTE]
@@ -83,13 +83,13 @@ In this section, you create a Python script to send events to the event hub you
8383
This quickstart uses an Azure Blob Storage as a checkpoint store. The checkpoint store is used to persist checkpoints (last read position).
8484
8585
### Create an Azure Storage and a blob container
86-
Follow these steps to create an Azure Storage account a blob container in it.
86+
Follow these steps to create an Azure Storage account a blob container in it.
8787
88-
1. [Create an Azure Storage account](../storage/common/storage-quickstart-create-account.md?tabs=azure-portal)
88+
1. [Create an Azure Storage account](../storage/common/storage-account-create.md?tabs=azure-portal)
8989
2. [Create a blob container](../storage/blobs/storage-quickstart-blobs-portal.md#create-a-container)
9090
3. [Get the connection string to the storage account](../storage/common/storage-configure-connection-string.md?#view-and-copy-a-connection-string)
9191
92-
Note down connection string and the container name. You will use them in the receive code.
92+
Note down connection string and the container name. You will use them in the receive code.
9393
9494
9595
### Create Python script to receive events
@@ -98,32 +98,32 @@ In this section, you create a Python script to receive events from your event hu
9898
9999
1. Open your favorite Python editor, such as [Visual Studio Code](https://code.visualstudio.com/)
100100
2. Create a script called **recv.py**.
101-
3. Paste the following code into recv.py. See the code comments for details.
101+
3. Paste the following code into recv.py. See the code comments for details.
102102
103103
```python
104104
import asyncio
105105
from azure.eventhub.aio import EventHubConsumerClient
106106
from azure.eventhub.extensions.checkpointstoreblobaio import BlobCheckpointStore
107-
108-
107+
108+
109109
async def on_event(partition_context, event):
110-
# print the event data
110+
# print the event data
111111
print("Received the event: \"{}\" from the partition with ID: \"{}\"".format(event.body_as_str(encoding='UTF-8'), partition_context.partition_id))
112-
113-
# update the checkpoint so that the program doesn't read the events
112+
113+
# update the checkpoint so that the program doesn't read the events
114114
# that it has already read when you run it next time
115115
await partition_context.update_checkpoint(event)
116-
116+
117117
async def main():
118-
# create an Azure blob checkpoint store to store the checkpoints
118+
# create an Azure blob checkpoint store to store the checkpoints
119119
checkpoint_store = BlobCheckpointStore.from_connection_string("AZURE STORAGE CONNECTION STRING", "BLOB CONTAINER NAME")
120-
120+
121121
# create a consumer client for the event hub
122122
client = EventHubConsumerClient.from_connection_string("EVENT HUBS NAMESPACE CONNECTION STRING", consumer_group="$Default", eventhub_name="EVENT HUB NAME", checkpoint_store=checkpoint_store)
123123
async with client:
124124
# call the receive method
125125
await client.receive(on_event=on_event)
126-
126+
127127
if __name__ == '__main__':
128128
loop = asyncio.get_event_loop()
129129
# run the main method
@@ -150,10 +150,10 @@ To run the script, open a command prompt that has Python in its path, and then r
150150
python send.py
151151
```
152152

153-
You should see the messages that were sent to the event hub in the receiver window.
153+
You should see the messages that were sent to the event hub in the receiver window.
154154

155155

156156
## Next steps
157157
In this quickstart, you have sent and receive events asynchronously. To learn how to send and receive events synchronously, see samples in [this location](https://github.com/Azure/azure-sdk-for-python/tree/master/sdk/eventhub/azure-eventhub/samples/sync_samples).
158158

159-
You can find all the samples (both sync and async) on the GitHub [here](https://github.com/Azure/azure-sdk-for-python/tree/master/sdk/eventhub/azure-eventhub/samples).
159+
You can find all the samples (both sync and async) on the GitHub [here](https://github.com/Azure/azure-sdk-for-python/tree/master/sdk/eventhub/azure-eventhub/samples).

0 commit comments

Comments
 (0)