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

Add API hook when bus is started but messages are not yet being delivered #87

Merged
merged 11 commits into from
Jan 13, 2020

Conversation

MendelMonteiro
Copy link
Collaborator

Resolves #86

src/Abc.Zebus.Testing/TestBus.cs Outdated Show resolved Hide resolved
src/Abc.Zebus.Tests/Dispatch/MessageDispatcherTests.cs Outdated Show resolved Hide resolved
src/Abc.Zebus.Tests/Lotus/ReplayMessageHandlerTests.cs Outdated Show resolved Hide resolved
@@ -30,11 +31,12 @@ public class DispatchQueue : IDisposable

internal SynchronizationContext SynchronizationContext { get; }

public DispatchQueue(IPipeManager pipeManager, int batchSize, string name)
public DispatchQueue(IPipeManager pipeManager, int batchSize, string name, TimeSpan timeToWaitForInitialization)
Copy link
Member

Choose a reason for hiding this comment

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

Why do we need a timeout? That seems dangerous as you won't be able to assume the bus is not processing the received messages.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

So as not to completely block the start-up of the Bus if one of the initialisers is blocked.

Copy link
Member

Choose a reason for hiding this comment

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

I'd prefer it to block, so it doesn't go undetected. @ocoanet what do you think?

src/Abc.Zebus/Dispatch/MessageDispatcher.cs Outdated Show resolved Hide resolved
src/Abc.Zebus/Dispatch/MessageDispatcher.cs Outdated Show resolved Hide resolved
src/Abc.Zebus/Dispatch/MessageDispatcher.cs Outdated Show resolved Hide resolved
@@ -14,6 +14,8 @@ public abstract class HostInitializer
/// </summary>
public virtual int Priority => 0;

public virtual bool CallAfterStartBeforeMessageDeliveryHasStarted => false;
Copy link
Member

Choose a reason for hiding this comment

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

Wouldn't a different function like AfterStartBeforeDispatch be better?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I considered it but thought that it didn't really make sense to be able to override both at the same time and therefore we shouldn't give the user the option to do so. It also would make it easier to change the default behaviour for all our hosts at once if we are confident that the new time is better in all situations.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

src/Abc.Zebus/Hosting/HostInitializer.cs Outdated Show resolved Hide resolved
@MendelMonteiro
Copy link
Collaborator Author

@ocoanet, do you want to have a look at the open comments on this PR or should we merge it?

@ocoanet ocoanet merged commit b971828 into master Jan 13, 2020
@alexandrekow alexandrekow deleted the add-started-but-not-delivering-api-hook branch September 2, 2020 05:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add API hook after the bus has started but before the dispatch queue starts delivering messages
3 participants