Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Event Grid Explorer - Adding Support for Event Grid V2 #737

Merged
merged 27 commits into from
Jun 10, 2024
Merged
Show file tree
Hide file tree
Changes from 24 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
f87a0d9
Event Grid Explorer - Adding support for Event Grid V2 in Service Bus…
t-wangamy Aug 16, 2023
cdd396b
Merge branch 'main' of https://github.com/paolosalvatori/ServiceBusEx…
t-wangamy Aug 16, 2023
e8e6791
Event Grid Explorer
t-wangamy Aug 16, 2023
b11b0c1
Event Grid Explorer
t-wangamy Aug 16, 2023
f0ad8fe
Event Grid Explorer
t-wangamy Aug 18, 2023
afe8a98
Wording
SeanFeldman Aug 18, 2023
38d75ec
Event Grid Explorer
t-wangamy Aug 18, 2023
e5b1c2a
Merge branch 'EventGridExplorer' of https://github.com/paolosalvatori…
t-wangamy Aug 18, 2023
7a7c463
Adhare to the license in the repo
SeanFeldman Nov 3, 2023
96e96e1
Fall back to the default API version
SeanFeldman Nov 5, 2023
f174fb4
Change tenantId
ErikMogensen Nov 7, 2023
5a76072
Added api-version commit
ErikMogensen Nov 7, 2023
bbc7b45
Change tenantId when logging in
ErikMogensen Nov 7, 2023
74bc13d
Merge pull request #747 from ErikMogensen/EventGridLogin
paolosalvatori Nov 9, 2023
8207abc
Improve UI event grid explorer (#752)
ErikMogensen Nov 20, 2023
fd86d19
Using Control plane sdk instead of generated files
harrieoriowo May 6, 2024
764e8cb
Finishing up the sdks
harrieoriowo May 16, 2024
2797407
Adding Filter UI
harrieoriowo May 20, 2024
a366114
Allowing multiple filters
harrieoriowo May 21, 2024
b7c3f54
Refining the explorer with proper error handling and the filters acce…
harrieoriowo May 25, 2024
e143794
Merge branch 'main' into EventGridExplorer
harrieoriowo May 25, 2024
1d43822
Resolving comments
harrieoriowo May 29, 2024
f1ed2e4
Merge branch 'EventGridExplorer' of https://github.com/paolosalvatori…
harrieoriowo May 29, 2024
46113e7
Resolving comments
harrieoriowo May 29, 2024
274791e
Removing custom exception and moving logic into filterfactory
harrieoriowo May 30, 2024
b45d3d5
Handling build warnings
harrieoriowo Jun 6, 2024
59b24b9
Build warnings resolved
harrieoriowo Jun 10, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -166,3 +166,6 @@ $RECYCLE.BIN/

# VS code settings
.vscode/settings.json

# Event Grid Explorer Library pkgrefgen
/src/EventGridExplorerLibrary/.pkgrefgen/
45 changes: 45 additions & 0 deletions EventGridExplorer_README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Event Grid Explorer - Support for Event Grid V2 in Service Bus Explorer
**Author:** Amy Wang

The Event Grid Explorer provides a tool for viewing and managing Event Grid V2 entities, including namespaces, topics and subscriptions, as well as provide create/delete operations for topics and subscriptions, publish/receive operations for events, and acknowledge/release/reject operations for events.
Currently, the Event Grid Explorer features the functionality that is available for the preview version of Event Grid V2.
This additional support for Event Grid enables users to test event delivery with ease, contributing to the adoption of the new service.
Note: The EventGridExplorerLibrary uses models that are generated by Microsoft (R) AutoRest Code Generator

## Connect to Event Grid

Under the File tab, the user can connect to an Event Grid V2 namespace by providing the Resource Group, Namespace Name, Subscription ID, API Version, Retry Timeout and Cloud Tenant which selects the associated tenant ID.

![Connect to EGV2](./media/connect-event-grid.png)

![Connection Info](./media/connect-info-event-grid.png)

## Main View

When the connection is successful, a tree view of the Event Grid V2 namespace with its contained topics and subscriptions is displayed along with properties views.
Right-clicking the Topics and Subscriptions nodes enables the user to create topics/subscriptions and right-clicking the existing topics and subscriptions enables the user to publish/receive events and delete these entities.

![Main View](./media/main-view-event-grid.png)

## Publish

When right-clicking the Publish option on a topic, the user can create and publish an event by entering the event source, type and JSON payload.
Events are expected to use the CloudEvent format, as specified in the Azure SDK for .NET

![Publish Event to Topic](./media/publish-event-grid.png)

## Receive

When receiving events through a subscription, the user can receive the maximum number of events (100) or a top number of events.
t-wangamy marked this conversation as resolved.
Show resolved Hide resolved
When successful, the data view table is populated with the received events and the event data is displayed in a JSON format.

![Receive Event Popup](./media/receive-popup-event-grid.png)

![Receive Events in Subscription](./media/receive-results-event-grid.png)

## Event Settlement

The user can multi-select the received events in the table to acknowledge, release, or reject events.
When successful, the event status column is updated with the operation performed.

![Event Action](./media/event-action-event-grid.png)
Binary file added media/connect-event-grid.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added media/connect-info-event-grid.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added media/event-action-event-grid.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added media/main-view-event-grid.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added media/publish-event-grid.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added media/receive-popup-event-grid.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added media/receive-results-event-grid.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/Common/Common.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
</AdditionalFiles>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\EventGridExplorerLibrary\EventGridExplorerLibrary.csproj" />
<ProjectReference Include="..\EventHubs\EventHubs.csproj" />
<ProjectReference Include="..\Relay\Relay.csproj" />
<ProjectReference Include="..\ServiceBus\ServiceBus.csproj" />
Expand Down
1 change: 1 addition & 0 deletions src/Common/Helpers/Constants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ public static class Constants
{
public const string QueueEntities = "Queues";
public const string TopicEntities = "Topics";
public const string SubscriptionEntities = "Subscriptions";
public const string RelayEntities = "Relays";
public const string EventHubEntities = "Event Hubs";
public const string NotificationHubEntities = "Notification Hubs";
Expand Down
54 changes: 54 additions & 0 deletions src/Common/Helpers/EventGridException.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#region Copyright
//=======================================================================================
// Microsoft Azure Customer Advisory Team
//
// This sample is supplemental to the technical guidance published on my personal
// blog at http://blogs.msdn.com/b/paolos/.
//
// Author: Paolo Salvatori
//=======================================================================================
// Copyright (c) Microsoft Corporation. All rights reserved.
//
// LICENSED UNDER THE APACHE LICENSE, VERSION 2.0 (THE "LICENSE"); YOU MAY NOT USE THESE
// FILES EXCEPT IN COMPLIANCE WITH THE LICENSE. YOU MAY OBTAIN A COPY OF THE LICENSE AT
// http://www.apache.org/licenses/LICENSE-2.0
// UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING, SOFTWARE DISTRIBUTED UNDER THE
// LICENSE IS DISTRIBUTED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, EITHER EXPRESS OR IMPLIED. SEE THE LICENSE FOR THE SPECIFIC LANGUAGE GOVERNING
// PERMISSIONS AND LIMITATIONS UNDER THE LICENSE.
//=======================================================================================
#endregion

#region Using Directives

using System;

#endregion


namespace ServiceBusExplorer.Helpers
{
public class EventGridException : Exception
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question - what does this custom exception type bring that is not handled by Exception?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had to make this custom exception so I can throw them without having to hit the client and have the client throw the exception.

Copy link
Collaborator

@SeanFeldman SeanFeldman May 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I must have missed that use. Could you point to where it's used? Thanks.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Found it here. That use is on the form. When an exception is thrown, the form logs it and swallows the exception. But with EventGrid, you're going to throw? Could you help me understand why it would need to be re-thrown?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My idea for the user experience is that I can check the format of the filter key, operator and value and verify them without depending on the armclient to do the verification.
Yes, the form will log the error, but it will still go ahead and still hit the client.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I might be missing something and would love to meet today to resolve it if possible.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I might be missing something and would love to meet today to resolve it if possible.

Let's continue the discussion at the method level comments, no need for a meeting 🙂

{
#region Public constructors
/// <summary>
/// Initializes a new instance of the <see cref="EventGridException"/> class.
/// </summary>
/// <param name="message">Message</param>
/// <param name="innerException">Inner exception</param>
public EventGridException(
string message,
Exception innerException = null)
: base(message, innerException)
{
FullMessage = message;
}

/// <summary>
/// Gets the full message of the exception.
/// </summary>
public string FullMessage { get; }
#endregion

}
}
77 changes: 77 additions & 0 deletions src/Common/Helpers/EventGridSubscriptionWrapper.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
#region Copyright
//=======================================================================================
// Microsoft Azure Customer Advisory Team
//
// This sample is supplemental to the technical guidance published on my personal
// blog at http://blogs.msdn.com/b/paolos/.
//
// Author: Paolo Salvatori
//=======================================================================================
// Copyright (c) Microsoft Corporation. All rights reserved.
//
// LICENSED UNDER THE APACHE LICENSE, VERSION 2.0 (THE "LICENSE"); YOU MAY NOT USE THESE
// FILES EXCEPT IN COMPLIANCE WITH THE LICENSE. YOU MAY OBTAIN A COPY OF THE LICENSE AT
// http://www.apache.org/licenses/LICENSE-2.0
// UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING, SOFTWARE DISTRIBUTED UNDER THE
// LICENSE IS DISTRIBUTED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, EITHER EXPRESS OR IMPLIED. SEE THE LICENSE FOR THE SPECIFIC LANGUAGE GOVERNING
// PERMISSIONS AND LIMITATIONS UNDER THE LICENSE.
//=======================================================================================
#endregion

#region Using Directives

using Azure.ResourceManager.EventGrid;

#endregion

namespace ServiceBusExplorer.Helpers
{
/// <summary>
/// This class adds a Subscriptions collection to the TopicDescription class
/// </summary>
public class EventGridSubscriptionWrapper
{
#region Public Constructors
/// <summary>
/// Initializes a new instance of the SubscriptionWrapper class.
/// </summary>
public EventGridSubscriptionWrapper()
{
SubscriptionDescription = null;
TopicDescription = null;
Filter = null;
}

/// <summary>
/// Initializes a new instance of the SubscriptionWrapper class.
/// </summary>
/// <param name="subscription">A subscription.</param>
/// <param name="topic">The topic the subscription belongs to.</param>
public EventGridSubscriptionWrapper(NamespaceTopicEventSubscriptionResource subscription, NamespaceTopicResource topic)
{
SubscriptionDescription = subscription;
TopicDescription = topic;
}

/// <summary>
/// Initializes a new instance of the SubscriptionWrapper class.
/// </summary>
/// <param name="subscription">A subscription.</param>
/// <param name="topic">The topic the subscription belongs to.</param>
/// <param name="filter">The OData filter.</param>
public EventGridSubscriptionWrapper(NamespaceTopicEventSubscriptionResource subscription, NamespaceTopicResource topic, string filter)
{
SubscriptionDescription = subscription;
TopicDescription = topic;
Filter = filter;
}
#endregion

#region Public Properties
public NamespaceTopicEventSubscriptionResource SubscriptionDescription { get; set; }
public NamespaceTopicResource TopicDescription { get; set; }
public string Filter { get; set; }
#endregion
}
}
Loading