rebus-org / Rebus.SqlServer

:bus: Microsoft SQL Server transport and persistence for Rebus
https://mookid.dk/category/rebus
Other
44 stars 45 forks source link

Add a "leasedby" column #16

Closed MrMDavidson closed 7 years ago

MrMDavidson commented 7 years ago

For now just a column useful for introspection scenarios. In future it may be used to further validate the lease (eg. Option to not allow renewal / forceful takeover of a lease if it belongs to someone else. Needs thought for cloud scenarios where entire workers may vanish)


Rebus is MIT-licensed. The code submitted in this pull request needs to carry the MIT license too. By leaving this text in, I hereby acknowledge that the code submitted in the pull request has the MIT license and can be merged with the Rebus codebase.

MrMDavidson commented 7 years ago

D'oh! Will roll that back when I get home. Was debugging something locally.


From: Mogens Heller Grabe notifications@github.com Sent: Monday, August 28, 2017 6:27:42 PM To: rebus-org/Rebus.SqlServer Cc: Michael Davidson; Author Subject: Re: [rebus-org/Rebus.SqlServer] Add a "leasedby" column (#16)

@mookid8000 commented on this pull request.


In Rebus.SqlServer.Tests/SqlTestHelper.cshttps://github.com/rebus-org/Rebus.SqlServer/pull/16#discussion_r135468138:

@@ -210,7 +210,7 @@ static void InitializeDatabase(string databaseName) static string GetConnectionStringForDatabase(string databaseName) { return Environment.GetEnvironmentVariable("REBUS_SQLSERVER")

  • ?? $"server=.; database={databaseName}; trusted_connection=true;";
  • ?? $"server=.\SqlExpress; database={databaseName}; trusted_connection=true;";

???

😁

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/rebus-org/Rebus.SqlServer/pull/16#pullrequestreview-58881626, or mute the threadhttps://github.com/notifications/unsubscribe-auth/ABTY6ddNNzyBBREkyJiLuKhzsIHtK1xDks5scnn-gaJpZM4PCSJm.

mookid8000 commented 7 years ago

😁

MrMDavidson commented 7 years ago

I don't think I can re-run the build for this... but the it's failing because of a file lock it seems. Re-running it should fix it.

mookid8000 commented 7 years ago

excellent work! 😁

it will take a little while for me to go through this .... it'll be out in Rebus.SqlServer 5 pre, probably a little later today

MrMDavidson commented 7 years ago

Awesome :) Will be nice to switch to using a nuget package instead of my copy/paste versions of SqlTransport and SqlLeaseTransport into our project. The lease transport is working really well for us and as a bonus it means inspection of the queue is really easy as the rows are virtually never locked and the leasedby/until columns provide great debugging and visibility.

mookid8000 commented 7 years ago

super!

one thing, though – is it intentional that there is no one-way client configuration for the lease-based transport?

MrMDavidson commented 7 years ago

Not intentional, no, just not something I'm familiar with. Is that an easier set up path where people only insert into the queue but don't process it? Can't see any technical reason that wouldn't work.

mookid8000 commented 7 years ago

Yes, it's simply a send-only Rebus endpoint, i.e. one that doesn't have an input queue, avoiding the need to spin up worker threads, etc.

I'll go add it – as the transport seems to satisfy the contract tests, e.g. accepting to be instantiated with a null input queue address, I think it is only about two missing configuration exetnsions....

MrMDavidson commented 7 years ago

Yeah - if SqlTransport supports it then SqlLeaseTransport should as it just changes the way messages are de-queued and rollbacks are performed.

mookid8000 commented 7 years ago

it's out in 5.0.0-b1 now 😄