-
-
Notifications
You must be signed in to change notification settings - Fork 276
#698 rest api on deadletter messages. Fetch, replay and delete #810
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
Merged
jeremydmiller
merged 10 commits into
JasperFx:main
from
erdtsieck:feature/698-replay-delete-and-rest-api-on-deadletter-messages
Apr 6, 2024
Merged
#698 rest api on deadletter messages. Fetch, replay and delete #810
jeremydmiller
merged 10 commits into
JasperFx:main
from
erdtsieck:feature/698-replay-delete-and-rest-api-on-deadletter-messages
Apr 6, 2024
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
… messages by id The most significant changes involve the reorganization of the `MarkDeadLetterEnvelopesAsReplayableAsync` method from the `Admin` class to the `DeadLetters` class, and the addition of a new method `MarkDeadLetterEnvelopeAsReplayableAsync` in the `DeadLetters` class. These changes were reflected in the `IDeadLetters` and `IMessageStoreAdmin` interfaces. Additionally, new test methods were added to ensure the new functionality works as expected. 1. The `MarkDeadLetterEnvelopesAsReplayableAsync` method was moved from the `Admin` class to the `DeadLetters` class in multiple files to better organize the code and group related functionality together. (Refer to `cross_database_message_storage.cs`, `PostgresqlMessageStoreTests.cs`, `SqlServerMessageStoreTests.cs`, `MessageDatabase.Admin.cs`, `MultiTenantedMessageStore.cs`, `StorageCommand.cs`) 2. A new method `MarkDeadLetterEnvelopeAsReplayableAsync` was added to the `DeadLetters` class in `MessageDatabase.DeadLetters.cs` and `MultiTenantedMessageStore.cs`. This method marks a specific envelope as replayable by its ID. 3. The `IDeadLetters` interface in `IMessageStore.cs` was updated to include the new `MarkDeadLetterEnvelopeAsReplayableAsync` method and the moved `MarkDeadLetterEnvelopesAsReplayableAsync` method. 4. The `IMessageStoreAdmin` interface in `IMessageStoreAdmin.cs` was updated to remove the `MarkDeadLetterEnvelopesAsReplayableAsync` method, as it was moved to the `IDeadLetters` interface. 5. The `NullMessageStore` class in `NullMessageStore.cs` was updated to include a stub implementation of the new `MarkDeadLetterEnvelopeAsReplayableAsync` method. 6. New test methods `move_dead_letter_messages_as_replayable_by_id_to_incoming` were added to `PostgresqlMessageStoreTests.cs` and `SqlServerMessageStoreTests.cs` to test the new functionality. 7. Some import statements were added and removed in various files, likely as a result of the code reorganization.
… messages by id The most significant changes involve the addition of a new method `DeleteDeadLetterEnvelopeAsync` in the `MessageDatabase<T>` class and its implementation in the `MultiTenantedMessageDatabase` class. This method allows for the deletion of a dead letter envelope from the dead letter table in the database. The `IDeadLetters` interface has also been updated to include this new method. Additionally, a new test method `delete_dead_letter_message_by_id` has been added to test the functionality of deleting dead letter messages. List of changes: 1. A new test method `delete_dead_letter_message_by_id` has been added to `PostgresqlMessageStoreTests.cs` and `SqlServerMessageStoreTests.cs` to test the deletion of dead letter messages. 2. A new method `DeleteDeadLetterEnvelopeAsync` has been added to the `MessageDatabase<T>` class in `MessageDatabase.DeadLetters.cs` to delete a dead letter envelope from the database. 3. The `DeleteDeadLetterEnvelopeAsync` method has been implemented in the `MultiTenantedMessageDatabase` class in `MultiTenantedMessageDatabase.cs` to delete a dead letter envelope from the database for a specific tenant or all tenants. 4. The `IDeadLetters` interface in `IMessageStore.cs` has been updated to include the `DeleteDeadLetterEnvelopeAsync` method. 5. The `NullMessageStore` class in `NullMessageStore.cs` has been updated to include a null implementation of the `DeleteDeadLetterEnvelopeAsync` method.
…and methods to handle requests and responses for dead-letter envelopes, and the replacement of methods that handle single dead-letter envelopes with ones that can handle multiple envelopes at once. 1. The `WolverineHttpEndpointRouteBuilderExtensions.cs` file was updated to include new classes `DeadLetterEnvelopeGetRequest`, `DeadLetterEnvelopeIdsRequest`, and `DeadLetterEnvelopesFoundResponse`. These classes are used to handle requests and responses for dead-letter envelopes. A new method `MapDeadLettersEndpoints` was also added to map endpoints for dead-letter envelopes. 2. The `PostgresqlMessageStoreTests.cs`, `SqlServerMessageStoreTests.cs`, and `MultiTenantedMessageDatabase.cs` files were updated to replace the methods `MarkDeadLetterEnvelopeAsReplayableAsync` and `DeleteDeadLetterEnvelopeAsync` with `MarkDeadLetterEnvelopesAsReplayableAsync` and `DeleteDeadLetterEnvelopesAsync` respectively. These new methods accept an array of IDs instead of a single ID, allowing multiple dead-letter envelopes to be marked as replayable or deleted at once. 3. The `PostgresqlMessageStore.cs` and `SqlServerMessageStore.cs` files were updated to implement the new `MarkDeadLetterEnvelopesAsReplayableAsync` and `DeleteDeadLetterEnvelopesAsync` methods. These methods use SQL queries to update or delete multiple records in the dead-letter table based on the provided array of IDs. 4. The `MessageDatabase.DeadLetters.cs` file was updated to make the `MarkDeadLetterEnvelopesAsReplayableAsync` and `DeleteDeadLetterEnvelopesAsync` methods abstract, enforcing their implementation in any derived classes. 5. The `IMessageStore.cs` interface was updated to replace the `MarkDeadLetterEnvelopeAsReplayableAsync` and `DeleteDeadLetterEnvelopeAsync` methods with `MarkDeadLetterEnvelopesAsReplayableAsync` and `DeleteDeadLetterEnvelopesAsync` respectively. 6. The `NullMessageStore.cs` file was updated to implement the new `MarkDeadLetterEnvelopesAsReplayableAsync` and `DeleteDeadLetterEnvelopesAsync` methods. These methods simply return a completed task, as they do not perform any operations in this class.
The codebase has undergone significant changes, primarily focusing on the handling of dead letters. The `WolverineHttpEndpointRouteBuilderExtensions.cs` file has been cleaned up, with several classes and methods removed. New classes and methods related to dead letter handling have been added to `MessageHandlers.cs` and `Program.cs`. The `DatabasePersistence.cs` and `IMessageStore.cs` files have been modified to include more fields in the `DeadLetterEnvelope` object. A bug in `MessageDatabase.DeadLetters.cs` has been fixed. The visibility of a method in `WolverineOptions.Serialization.cs` has been changed. New tests, classes, methods, and handlers have been added to handle dead letter related requests and messages. A new profile has been added to `launchSettings.json`. Changes: 1. Removed the usage of `Wolverine.Persistence.Durability` namespace in `WolverineHttpEndpointRouteBuilderExtensions.cs`. 2. Removed several classes and a method from `WolverineHttpEndpointRouteBuilderExtensions.cs`. 3. Added new record and class to `MessageHandlers.cs`. 4. Added new method to `MessageHandler` class in `MessageHandlers.cs`. 5. Added the usage of `Wolverine.ErrorHandling` namespace in `Program.cs`. 6. Added a new policy in `Program.cs`. 7. Added a new endpoint in `Program.cs`. 8. Added a new method in `Program.cs`. 9. Modified the `ReadDeadLetterAsync` method in `DatabasePersistence.cs`. 10. Fixed a bug in `MessageDatabase.DeadLetters.cs`. 11. Modified the `DeadLetterEnvelope` record in `IMessageStore.cs`. 12. Changed the visibility of `DetermineSerializer` method in `WolverineOptions.Serialization.cs`. 13. Added a new test in `dead_letter_endpoints.cs`. 14. Added new classes and a method in `DeadLettersEndpointExtensions.cs`. 15. Added a new handler in `MessageThatAlwaysGoesToDeadLetterHandler1388008025.cs`. 16. Added a new handler in `POST_send_always_dead_letter.cs`. 17. Added a new profile in `launchSettings.json`.
…delete-and-rest-api-on-deadletter-messages
The most significant changes were made to the `dead_letter_endpoints.cs` file, where the exception message generation was modified and two new test methods were added. The `DeadLettersEndpointExtensions.cs` file was also updated to uncomment previously commented code and add a new namespace. Lastly, the `MessageDatabase.DeadLetters.cs` file was modified to change the way the exception message is queried from the database. 1. In `dead_letter_endpoints.cs`, the exception message generation was modified by adding the prefix "fetchable-" to the generated GUID. The method of accessing the first message in the `deadletters` list was also changed. Two new test methods, `replay_one` and `delete_one`, were added to test the functionality of replaying and deleting a message, respectively. 2. In `DeadLettersEndpointExtensions.cs`, previously commented code was uncommented. This code maps the "/replay" and "/" (delete) endpoints to their respective methods in the `IMessageStore` service. The `Microsoft.AspNetCore.Mvc` namespace was also added to the using directives. 3. In `MessageDatabase.DeadLetters.cs`, the method of querying the exception message from the database was changed. Instead of using the `LIKE` keyword for pattern matching, the `=` operator was used to check for exact equality.
…integration in the documentation
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.