AzureEventGridSimulator icon indicating copy to clipboard operation
AzureEventGridSimulator copied to clipboard

Cloud events + publishing to Azure Service Bus

Open EtherZa opened this issue 2 years ago • 2 comments
trafficstars

This PR is a little larger that I would like it to be as I never intended for it to be merged upstream due to some breaking changes. It also includes multiple features.

Having said that; it may be useful and as such will leave it to you to include, decline, break apart or just ignore.

Changes:

  • Publish to Azure Service Bus topic/queue
    • With support for adding static/dynamic delivery properties as per Azure Event Grid
  • Cloud Events
    • Configured per topic
    • Routing is maintained (ie. /api/events for both cloud events and the default. Topic matched by port.)
  • Publish assertions using RichardSzalay.MockHttp
  • Uses System.Text.Json where possible, but falls back to Newtonsoft for JsonPath queries

Breaking changes:

  • In order to facilitate multiple subscriber classes, sub-categories have been added to the topic's subscribers section.
{
      "name": "ATopicThatPushesToBothRequestCatcherAndAzureServiceBus",
      "port": 60105,
      "key": "TheLocal+DevelopmentKey=",
      "subscribers": {
        "http": [
          {
            "name": "RequestCatcherSubscription",
            "endpoint": "https://azureeventgridsimulator.requestcatcher.com",
            "disableValidation": true
          }
        ],
        "serviceBus": [
          {
            "name": "SVB",
            "namespace": "azure-service-bus-namespace",
            "sharedAccessKeyName": "RootManageSharedAccessKey",
            "sharedAccessKey": "ServiceBusSharedKey==",
            "topic": "sample-topic-or-queue-name",
            "properties": {
              "eTag": {
                "type": "dynamic",
                "value": "data.eTag"
              },
              "Label": {
                "type": "dynamic",
                "value": "Subject"
              },
              "CustomProperty": {
                "type": "static",
                "value": "Custom property value"
              }
            }
          }
        ]
      }
    }

Apologies again for the behemoth submission. Please do with it as you see fit.

Richard

EtherZa avatar Feb 08 '23 06:02 EtherZa

Awesome work! May I ask why it never got merged? Seems insanely useful.

jsommr avatar Mar 09 '24 11:03 jsommr

Awesome work! May I ask why it never got merged? Seems insanely useful.

I suspect due to it being unsolicited and introducing a breaking change (configuration schema), but I never heard anymore.

I see that some conflicts have now crept in too.

EtherZa avatar Mar 09 '24 12:03 EtherZa