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

Support send-only endpoint configuration #714

Merged
merged 8 commits into from
Sep 6, 2023
Merged

Support send-only endpoint configuration #714

merged 8 commits into from
Sep 6, 2023

Conversation

jpalac
Copy link
Contributor

@jpalac jpalac commented Sep 5, 2023

@jpalac jpalac changed the title Enable SendOnly support Support send-only endpoint configuration Sep 5, 2023

class SendOnlyReceiver : IMessageReceiver
{
static readonly InvalidOperationException SendOnlyEndpointException = new($"This endpoint cannot process messages because it is configured in send-only mode. Remove the '{nameof(EndpointConfiguration)}.{nameof(EndpointConfiguration.SendOnly)}' configuration or do not call '{nameof(IFunctionEndpoint)}.{nameof(IFunctionEndpoint.ProcessAtomic)}/{nameof(IFunctionEndpoint.ProcessNonAtomic)}'");
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure if we can safely have a singleton exception instance and throw it multiple times, possibly concurrently. What happens if it is thrown at one site, then thrown from a different site before the first throw is caught? What does the stack trace look like? I think it would be better to recreate this every time.

Perhaps we want to change this to make it closer to Particular/NServiceBus.AzureFunctions.Worker.ServiceBus#377

@jpalac jpalac merged commit bba69ce into master Sep 6, 2023
@jpalac jpalac deleted the send-only-config branch September 6, 2023 06:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Using SendOnly throws a KeyNotFoundException with Main as a key
3 participants