Hey there,
We’re starting to use the Particular ecosystem, we’re using the Azure Functions preview stuff and Azure Service Bus as transport and it works really good. Ofcourse there is the limitation that they are unable to use the installer. So we’ve adopted operational scripting for Azure Service Bus.
We use it in our pipeline, and create the queues, logical endpoints and subscriptions that we need.
The creation of endpoints and subscriptions is idempotent, it will first check if it already exists.
The creation of queues is not!
It will throw an exception. Is this something that can be changed to be idempotent as well?
The script I execute is shown below.
asb-transport.exe endpoint create Adapter.Klant -c $connectionString
asb-transport.exe endpoint create Domein.Hr -c $connectionString
Write-Output "Subscribing Klant adapter to medewerker events..."
asb-transport.exe endpoint subscribe Adapter.Klant Bedrijf.Hr.Messages.MedewerkerCreated -c $connectionString
asb-transport.exe endpoint subscribe Adapter.Klant Bedrijf.Hr.Messages.MedewerkerDeleted -c $connectionString
asb-transport.exe endpoint subscribe Adapter.Klant Bedrijf.Hr.Messages.MedewerkerUpdated -c $connectionString
Write-Output "Create error and audit queues"
asb-transport.exe queue create error -c $connectionString
asb-transport.exe queue create audit -c $connectionString
The output from my task is provided below.
Creating logical endpoints...
Queue 'McMaster.Extensions.CommandLineUtils.CommandArgument' already exists, skipping creation
Topic 'McMaster.Extensions.CommandLineUtils.CommandOption' already exists, skipping creation
Subscription 'McMaster.Extensions.CommandLineUtils.CommandArgument' already exists, skipping creation
Endpoint 'Adapter.Klant' is ready.
Queue 'McMaster.Extensions.CommandLineUtils.CommandArgument' already exists, skipping creation
Topic 'McMaster.Extensions.CommandLineUtils.CommandOption' already exists, skipping creation
Subscription 'McMaster.Extensions.CommandLineUtils.CommandArgument' already exists, skipping creation
Endpoint 'Domein.Hr' is ready.
Subscribing Klant adapter to medewerker events...
Rule 'McMaster.Extensions.CommandLineUtils.CommandArgument' for topic 'McMaster.Extensions.CommandLineUtils.CommandOption' and subscription 'McMaster.Extensions.CommandLineUtils.CommandOption' already exists, skipping creation. Verify SQL filter matches '[NServiceBus.EnclosedMessageTypes] LIKE '%Bedrijf.Hr.Messages.MedewerkerCreated%'.
Endpoint 'Adapter.Klant' subscribed to 'Bedrijf.Hr.Messages.MedewerkerCreated'.
Rule 'McMaster.Extensions.CommandLineUtils.CommandArgument' for topic 'McMaster.Extensions.CommandLineUtils.CommandOption' and subscription 'McMaster.Extensions.CommandLineUtils.CommandOption' already exists, skipping creation. Verify SQL filter matches '[NServiceBus.EnclosedMessageTypes] LIKE '%Bedrijf.Hr.Messages.MedewerkerDeleted%'.
Endpoint 'Adapter.Klant' subscribed to 'Bedrijf.Hr.Messages.MedewerkerDeleted'.
Rule 'McMaster.Extensions.CommandLineUtils.CommandArgument' for topic 'McMaster.Extensions.CommandLineUtils.CommandOption' and subscription 'McMaster.Extensions.CommandLineUtils.CommandOption' already exists, skipping creation. Verify SQL filter matches '[NServiceBus.EnclosedMessageTypes] LIKE '%Bedrijf.Hr.Messages.MedewerkerUpdated%'.
Endpoint 'Adapter.Klant' subscribed to 'Bedrijf.Hr.Messages.MedewerkerUpdated'.
Create error and audit queues
asb-transport.exe : Command failed with exception (MessagingEntityAlreadyExistsException): SubCode=40900. Conflict.
You're requesting an operation that isn't allowed in the resource's current state. To know more visit
https://aka.ms/sbResourceMgrExceptions. . TrackingId:a618e317-a0af-40f1-85b6-49f40448b76c_G4,
SystemTracker:xxxxxxxxxxxxxxx.error, Timestamp:2020-09-23T07:28:06
At D:\a\1\src\nservicebus.ps1:13 char:1
+ asb-transport.exe queue create error -c $connectionString
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (Command failed ...-09-23T07:28:06:String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError
##[error]PowerShell exited with code '1'.
Finishing: Create NServiceBus queues and topics