Skip to content

Commit ebfe73e

Browse files
Freshness. Links and Acrolinx.
1 parent cab2e48 commit ebfe73e

File tree

2 files changed

+34
-23
lines changed

2 files changed

+34
-23
lines changed

articles/event-grid/includes/register-provider-cli.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@
1111

1212
## Enable the Event Grid resource provider
1313

14-
1. If you haven't previously used Event Grid in your Azure subscription, you might need to register the Event Grid resource provider. Run the following command to register the provider:
14+
1. If this article is the first time that user use Event Grid in your Azure subscription, you might need to register the Event Grid resource provider. Run the following command to register the provider:
1515

1616
```azurecli-interactive
1717
az provider register --namespace Microsoft.EventGrid
1818
```
1919
20-
2. It might take a moment for the registration to finish. To check the status, run the following command:
20+
1. It might take a moment for the registration to finish. To check the status, run the following command:
2121
2222
```azurecli-interactive
2323
az provider show --namespace Microsoft.EventGrid --query "registrationState"

articles/event-grid/publish-events-using-namespace-topics.md

Lines changed: 32 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,24 @@ ms.date: 02/20/2024
1010

1111
# Publish to namespace topics and consume events in Azure Event Grid
1212

13-
This article provides a quick introduction to pull delivery using the ``curl`` bash shell command to publish, receive, and acknowledge events. Event Grid resources are created using CLI commands. This article is suitable for a quick test of the pull delivery functionality. For sample code using the data plane SDKs, see the [.NET](event-grid-dotnet-get-started-pull-delivery.md) or the Java samples. For Java, we provide the sample code in two articles: [publish events](publish-events-to-namespace-topics-java.md) and [receive events](receive-events-from-namespace-topics-java.md) quickstarts.
14-
For more information about the pull delivery model, see the [concepts](concepts-event-grid-namespaces.md) and [pull delivery overview](pull-delivery-overview.md) articles.
13+
This article provides a quick introduction to pull delivery using the `curl` bash shell command to publish, receive, and acknowledge events. Use Azure CLI commands to create Azure Event Grid resources. This article is suitable for a quick test of the pull delivery functionality.
14+
15+
For sample code that uses the data plane SDKs, see these resources:
16+
17+
- .NET: [Send and receive messages from an Azure Event Grid namespace topic (.NET)](event-grid-dotnet-get-started-pull-delivery.md)
18+
- Java: [Publish events to namespace topics using Java](publish-events-to-namespace-topics-java.md)
19+
- Java: [Receive events using pull delivery with Java](receive-events-from-namespace-topics-java.md)
20+
21+
For more information about the pull delivery model, see [Azure Event Grid namespace concepts](concepts-event-grid-namespaces.md) and [Pull delivery with HTTP](pull-delivery-overview.md) articles.
1522

1623
[!INCLUDE [quickstarts-free-trial-note.md](~/reusable-content/ce-skilling/azure/includes/quickstarts-free-trial-note.md)]
1724

1825
[!INCLUDE [azure-cli-prepare-your-environment.md](~/reusable-content/azure-cli/azure-cli-prepare-your-environment.md)]
1926

20-
- This article requires version 2.0.70 or later of the Azure CLI. If using Azure Cloud Shell, the latest version is already installed.
27+
- This article requires version 2.0.70 or later of the Azure CLI. If you use Azure Cloud Shell, the latest version is already installed.
2128

2229
## Create a resource group
30+
2331
Create an Azure resource group with the [az group create](/cli/azure/group#az-group-create) command. You use this resource group to contain all resources created in this article.
2432

2533
The general steps to use Cloud Shell to run commands are:
@@ -33,7 +41,7 @@ The general steps to use Cloud Shell to run commands are:
3341
```azurecli-interactive
3442
resource_group="<your-resource-group-name>"
3543
```
36-
2. Create a resource group. Change the location as you see fit.
44+
1. Create a resource group. Change the location as you see fit.
3745
3846
```azurecli-interactive
3947
az group create --name $resource_group --location eastus
@@ -48,14 +56,14 @@ An Event Grid namespace provides a user-defined endpoint to which you post your
4856
- It should be between 3-50 characters.
4957
- It should be regionally unique.
5058
- Only allowed characters are a-z, A-Z, 0-9 and -
51-
- It shouldn't start with reserved key word prefixes like `Microsoft`, `System` or `EventGrid`.
59+
- It shouldn't start with reserved key word prefixes like `Microsoft`, `System`, or `EventGrid`.
5260
5361
1. Declare a variable to hold the name for your Event Grid namespace. Specify a name for the namespace by replacing `<your-namespace-name>` with a value you like.
5462
5563
```azurecli-interactive
5664
namespace="<your-namespace-name>"
5765
```
58-
2. Create a namespace. You might want to change the location where it's deployed.
66+
1. Create a namespace. You might want to change the location where you deploy it.
5967
6068
```azurecli-interactive
6169
az eventgrid namespace create -g $resource_group -n $namespace -l eastus
@@ -70,22 +78,22 @@ Create a topic that's used to hold all events published to the namespace endpoin
7078
```azurecli-interactive
7179
topic="<your-topic-name>"
7280
```
73-
2. Create your namespace topic:
81+
1. Create your namespace topic:
7482
7583
```azurecli-interactive
7684
az eventgrid namespace topic create -g $resource_group -n $topic --namespace-name $namespace
7785
```
7886
7987
## Create an event subscription
8088
81-
Create an event subscription setting its delivery mode to *queue*, which supports [pull delivery](pull-delivery-overview.md). For more information on all configuration options,see the latest Event Grid control plane [REST API](/rest/api/eventgrid).
89+
Create an event subscription setting its delivery mode to *queue*, which supports [pull delivery](pull-delivery-overview.md). For more information on all configuration options, see [Azure Event Grid REST API](/rest/api/eventgrid).
8290
8391
1. Declare a variable to hold the name for an event subscription to your namespace topic. Specify a name for the event subscription by replacing `<your-event-subscription-name>` with a value you like.
8492
8593
```azurecli-interactive
8694
event_subscription="<your-event-subscription-name>"
8795
```
88-
2. Create an event subscription to the namespace topic:
96+
1. Create an event subscription to the namespace topic:
8997
9098
```azurecli-interactive
9199
az eventgrid namespace topic event-subscription create -g $resource_group --topic-name $topic -n $event_subscription --namespace-name $namespace --delivery-configuration "{deliveryMode:Queue,queue:{receiveLockDurationInSeconds:300,maxDeliveryCount:4,eventTimeToLive:P1D}}"
@@ -101,7 +109,7 @@ Now, send a sample event to the namespace topic by following steps in this secti
101109
```azurecli-interactive
102110
namespace_resource_id=$(az eventgrid namespace show -g $resource_group -n $namespace --query "id" --output tsv)
103111
```
104-
2. Get the first key from the namespace:
112+
1. Get the first key from the namespace:
105113
106114
```azurecli-interactive
107115
key=$(az eventgrid namespace list-key -g $resource_group --namespace-name $namespace --query "key1" --output tsv)
@@ -114,14 +122,15 @@ Now, send a sample event to the namespace topic by following steps in this secti
114122
```azurecli-interactive
115123
publish_operation_uri="https://"$(az eventgrid namespace show -g $resource_group -n $namespace --query "topicsConfiguration.hostname" --output tsv)"/topics/"$topic:publish?api-version=2023-06-01-preview
116124
```
117-
2. Create a sample [CloudEvents](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/formats/json-format.md) compliant event:
125+
1. Create a sample [CloudEvents](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/formats/json-format.md) compliant event:
118126
119127
```azurecli-interactive
120128
event=' { "specversion": "1.0", "id": "'"$RANDOM"'", "type": "com.yourcompany.order.ordercreatedV2", "source" : "/mycontext", "subject": "orders/O-234595", "time": "'`date +%Y-%m-%dT%H:%M:%SZ`'", "datacontenttype" : "application/json", "data":{ "orderId": "O-234595", "url": "https://yourcompany.com/orders/o-234595"}} '
121129
```
122130
123-
The `data` element is the payload of your event. Any well-formed JSON can go in this field. For more information on properties (also known as context attributes) that can go in an event, see the [CloudEvents](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md) specifications.
124-
3. Use CURL to send the event to the topic. CURL is a utility that sends HTTP requests.
131+
The `data` element is the payload of your event. Any well-formed JSON can go in this field. Properties that can go into an event are also known as *context attributes*. For more information, see [CloudEvents](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md).
132+
133+
1. Use CURL to send the event to the topic. CURL is a utility that sends HTTP requests.
125134
126135
```azurecli-interactive
127136
curl -X POST -H "Content-Type: application/cloudevents+json" -H "Authorization:SharedAccessKey $key" -d "$event" $publish_operation_uri
@@ -136,32 +145,33 @@ You receive events from Event Grid using an endpoint that refers to an event sub
136145
```azurecli-interactive
137146
receive_operation_uri="https://"$(az eventgrid namespace show -g $resource_group -n $namespace --query "topicsConfiguration.hostname" --output tsv)"/topics/"$topic/eventsubscriptions/$event_subscription:receive?api-version=2023-06-01-preview
138147
```
139-
2. Submit a request to consume the event:
148+
149+
1. Submit a request to consume the event:
140150
141151
```azurecli-interactive
142152
curl -X POST -H "Content-Type: application/json" -H "Authorization:SharedAccessKey $key" $receive_operation_uri
143153
```
144154
145155
### Acknowledge an event
146156
147-
After you receive an event, you pass that event to your application for processing. Once you have successfully processed your event, you no longer need that event to be in your event subscription. To instruct Event Grid to delete the event, you **acknowledge** it using its lock token that you got on the receive operation's response.
157+
After you receive an event, you pass that event to your application for processing. After you successfully process your event, you no longer need that event to be in your event subscription. To instruct Event Grid to delete the event, you **acknowledge** it using its lock token that you got on the receive operation's response.
148158
149-
1. In the previous step, you should have received a response that includes a `brokerProperties` object with a `lockToken` property. Copy the lock token value and set it on an environment variable:
159+
1. In the previous section, you received a response that includes a `brokerProperties` object with a `lockToken` property. Copy the lock token value and set it on an environment variable:
150160
151161
```azurecli-interactive
152162
lockToken="<paste-the-lock-token-here>"
153163
```
154-
2. Now, build the acknowledge operation payload, which specifies the lock token for the event you want to be acknowledged.
164+
1. Now, build the acknowledge operation payload, which specifies the lock token for the event you want to be acknowledged.
155165
156166
```azurecli-interactive
157167
acknowledge_request_payload=' { "lockTokens": ["'$lockToken'"]} '
158168
```
159-
3. Proceed with building the string with the acknowledge operation URI:
169+
1. Proceed with building the string with the acknowledge operation URI:
160170
161171
```azurecli-interactive
162172
acknowledge_operation_uri="https://"$(az eventgrid namespace show -g $resource_group -n $namespace --query "topicsConfiguration.hostname" --output tsv)"/topics/"$topic/eventsubscriptions/$event_subscription:acknowledge?api-version=2023-06-01-preview
163173
```
164-
4. Finally, submit a request to acknowledge the event received:
174+
1. Finally, submit a request to acknowledge the event received:
165175
166176
```azurecli-interactive
167177
curl -X POST -H "Content-Type: application/json" -H "Authorization:SharedAccessKey $key" -d "$acknowledge_request_payload" $acknowledge_operation_uri
@@ -173,5 +183,6 @@ After you receive an event, you pass that event to your application for processi
173183
{"succeededLockTokens":["CiYKJDQ4NjY5MDEyLTk1OTAtNDdENS1BODdCLUYyMDczNTYxNjcyMxISChDZae43pMpE8J8ovYMSQBZS"],"failedLockTokens":[]}
174184
```
175185
176-
## Next steps
177-
To learn more about pull delivery model, see [Pull delivery overview](pull-delivery-overview.md).
186+
## Next step
187+
188+
To learn more about pull delivery model, see [Pull delivery with HTTP](pull-delivery-overview.md).

0 commit comments

Comments
 (0)