Skip to content

Commit

Permalink
Add try/catch to CreateSubscriptionTableText (#864)
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidBoike authored Jun 23, 2021
1 parent 22c27dc commit c8a8f88
Showing 1 changed file with 16 additions and 9 deletions.
25 changes: 16 additions & 9 deletions src/NServiceBus.Transport.SqlServer/Queuing/SqlConstants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -284,16 +284,23 @@ AND type in (N'U'))
RETURN
END
CREATE TABLE {0} (
QueueAddress NVARCHAR(200) NOT NULL,
Endpoint NVARCHAR(200),
Topic NVARCHAR(200) NOT NULL,
PRIMARY KEY CLUSTERED
(
Endpoint,
Topic
BEGIN TRY
CREATE TABLE {0} (
QueueAddress NVARCHAR(200) NOT NULL,
Endpoint NVARCHAR(200),
Topic NVARCHAR(200) NOT NULL,
PRIMARY KEY CLUSTERED
(
Endpoint,
Topic
)
)
)
END TRY
BEGIN CATCH
EXEC sp_releaseapplock @Resource = '{0}_lock';
THROW;
END CATCH;
EXEC sp_releaseapplock @Resource = '{0}_lock'";

public static readonly string SubscribeText = @"
Expand Down

0 comments on commit c8a8f88

Please sign in to comment.