Evolusi Web dan Perbedaan antara Web 2.0 dengan Web 3.0

Web 1.0 adalah web yang dikembangkan untuk pengaksesan informasi dan sedikit interaktif. Secara garis besar, Web 1.0 bersifat read-only yang artinya halaman web hanya untuk menampilkan informasi saja…

Smartphone

独家优惠奖金 100% 高达 1 BTC + 180 免费旋转




Getting started with Azure Event Grid Extension for Visual Studio Code

I love Visual Studio Code and all the extensions that are available. It has become my preferred editor for almost everything (replacing Notepad++), except for when developing in Visual Studio.

In this post I’ll walk through how to get started and use the Azure Event Grid extension for Visual Studio Code. Let’s get started.

Before we can begin we need to make sure we have the following installed and setup:

First thing we need to do is connect to your Azure subscription. This will happen automatically when you go to the Azure tab in Visual Studio Code. You can also sign in from the Command palette and searching for “Azure: Login”.

Now that you’re signed in, let’s go ahead and create an Event Grid topic.

1. In the Event Grid Topics pane, click on the + button to create a new topic:

2. Then select your Azure Subscription to associate this topic with:

3. Now provide a topic name. I will use “VSCodeEventGridTopicDemo” for my demo:

4. Next select a resource group for your topic. I will use “RGVSCodeEventGridDemo” for my demo:

5. Select your location for the resources:

6. Done. In a few seconds your Azure Event Grid will be created and displayed in Visual Studio Code:

You can login to your Azure Subscription and see everything we just created. Keep your Azure Subscription loaded in the browser as we’ll use it for the next section.

Now that we have an Event Grid Topic setup we need to create a subscription to receive the events we send it.

1. Here I will create a new Azure Function app:

2. Now create a new Event Grid Trigger function and after it’s created click on the Add Event Grid subscription link:

3. Fill in the details relating to the Azure Event Grid Topic we created earlier and then press the Create button:

Your Event Grid Topic now has an Event Grid Subscription and is ready to test!

Apart from managing your Event Grids resources in Visual Studio Code, you can also generate and send mock events which is great for testing purposes. Instead of using Postman to do this, I find the Event Grid Extension better and mocking and sending events. So let’s get started now mocking some events.

1. To generate a mocked event, right click on your Event Grid Subscription in Visual Studio Code and select Create Mock Event Generator:

2. A new file will be created with all the details for generating mocked events for this subscription. The pattern property is defined with regex patterns for generating random data. You will noticed I changed the data section pattern value with regex pattern to generate the mocked data for my event:

3. At the top of the event generator file will be two links: Send Events and Preview Events. The actions do exactly as they say and are what you want to use when generating your mocked events.

4. If we click on Preview Events, another file is created with a preview of mocked event data to be sent. Notice the different values between the events. This is from the regex logic defined in the event generator. This can be customized to generate data appropriate for your needs.

5. Now click on Send Events link at the top of the event generator file and go to your Azure Portal where you previously defined your Azure Function for your Event Grid Topic, and you will see in the logs your mocked events:

As you can see the Azure Event Grid extension for Visual Studio Code is very powerful and is a handy tool to use in your Azure development.

Enjoy!

Add a comment

Related posts:

Credit Card Fraud Detection using Keras and R

Now days almost everyone is using credit and debit cards to perform purchases from physical and online shops. Billions of Euros, USD, Yen, etc are being transferred in order to buy goods and services…

How to create an always free K8S cluster in Oracle Cloud

Oracle Cloud Infrastructure (OCI) has an always-free plan (here), where you have access FREE and FOREVER to some computing resources. With this in mind, I started thinking about how I could create a…

Life is Not Black and White

My mind was filled with fairytales, stories of Hindu mythology and various classical narratives which took me the through the plot of good vs. evil. The common theme of these stories was the fight of…