Update the Reservation Car Demo#102
Conversation
…r to 1.15.3 Upgrade .NET SDK and dependencies; update tests Updated `IntegrationTest.yaml` to use .NET SDK 9.0.x Updated Dapr package references from `1.15.0-rc02` to `1.15.3` and Polly from `8.4.1` to `8.5.2` in multiple `.csproj` files. Changed target frameworks from `net8.0` to `net9.0` across several projects. Modified `Dockerfile` to use .NET 9.0 base images for compatibility. Various package references in integration test projects were also updated to the latest versions, including OpenTelemetry and Swashbuckle.
The test files `test_a_failed_on_2_no_callback.received.txt` and `test_a_failed_on_2_no_callback_revert.received.txt` have been updated to remove several OpenTelemetry logging entries related to saga operations and their outcomes. The changes reflect the execution flow of the saga, including retries and final outcomes. Additionally, the revert test file has been modified to indicate the success of the revert operation, which was previously absent.
Update .gitignore for integration test files Added entries to ignore three .received.txt files from the Sagaway.IntegrationTests project to keep the repository clean and prevent unnecessary tracking of generated approval test files.
Enhanced the codebase with a new Blazor component for car reservations, including customer and car class selection. Updated the `.gitignore` for web artifacts, modified test files for saga logs, and added new classes for managing reservations. Updated `docker-compose.yml` to include a new service for the reservation UI and adjusted the `Program.cs` for service registration. Configured Nginx in `nginx.conf` to serve the Blazor app and proxy API requests. Added Tailwind CSS support with `package.json` and `package-lock.json`. Overall, these changes improve functionality, performance, and maintainability of the application.
- Replaced asynchronous callback methods in `CarReservationActor` and `CarReservationCancellationActor` with synchronous versions for simplification. - Updated saga completion methods to save saga logs to Dapr state store with a 5-minute TTL. - Added a new endpoint in `Program.cs` for retrieving saga logs by reservation ID. - Modified reservation request logic in `App.razor` to directly call the API client without simulated delays. - Enhanced `ReservationStatusDisplay.razor` to display reservation statuses in a table format and added UI elements for refreshing and debugging. - Updated `IReservationApiClient` to include a method for fetching saga logs, implemented in `ReservationApiClient`. - Renamed and updated `ReservationStatus` class for consistency with client-side data representation. - Modified Nginx configuration to handle saga log requests. - Updated `docker-compose.yml` and `launchSettings.json` for service configuration changes. - Improved UI elements in `ReservationStatusDisplay.razor` for better user experience.
This commit introduces several key improvements to the reservation system. A `CarClass` property has been added to the `ReservationState` and `BookingInfo` records to better represent the type of car associated with reservations. The TTL for state saving in the `CarReservationActor` and `CarReservationCancellationActor` classes has been increased from 5 to 15 minutes for improved data retention. The `ReservationStatusDisplay.razor` component has been restructured for better loading state handling and user-friendly display of reservation statuses, including cancellation actions. Error handling in API calls has been refined for clearer logging and user feedback. New methods, `HandleCancelReservation`, `GetCarClassNameForCode`, and `GetCarImageForClass`, have been introduced to enhance user interaction and display. Additionally, the `FormatSagaLogAsHtml` method improves the readability of saga logs in the UI. The project file has been updated to ensure the inclusion of the `DefaultCar.png` image, and the Nginx configuration has been modified to handle cancellation requests appropriately.
The TTL for entries in the metadata dictionary has been changed from 5 minutes to 1 minute in the `/booking-queue` and `/inventory-queue` endpoints. This adjustment alters the data retention policy. Additionally, the error handling for the `/customer-reservations` endpoint has been updated to specifically catch `DaprException`, enhancing robustness against known issues with Dapr's state management, particularly addressing bug #3787 related to invalid output.
Updated retry intervals to seconds, enhanced user experience in App.razor with better error handling and loading states. Refactored ReservationStatusDisplay for clearer status presentation. Introduced IReservationManager for centralized reservation logic and added System.Reactive for observable state management. Moved DTO classes to a new namespace for better organization. Overall, these changes enhance functionality, maintainability, and user interaction.
This commit introduces new endpoints for managing car inventory, including `/car-inventory` for fetching current inventory and `/update-allocation` for updating maximum allocations. The reservation management logic has been refactored to use enums for reservation statuses, enhancing clarity and maintainability. Additionally, the handling of car class reservations now dynamically checks maximum allocations, and the UI has been updated to provide an inventory management interface with improved user experience. Dapr client interactions have been refined for better state management, and the Nginx configuration has been updated to support the new routes. Overall, these changes improve the robustness and maintainability of the car reservation system.
- Introduced `MakeStateStoreKey` for consistent key creation. - Improved logging messages for better action tracking. - Updated state retrieval and saving in Dapr for consistency. - Enhanced saga log UI with better styling and interactivity. - Added JavaScript functions for managing saga log display. - Improved Blazor component for reservation status with better error handling. - Modified HTML structure and CSS for improved user experience.
- Updated billing status logic for refunds. - Enhanced customer reservations retrieval with JSON and pagination. - Adjusted car reservation cancellation to use exponential backoff. - Improved logging for customer reservations and pagination. - Refactored App.razor to load predefined customers and handle errors. - Enhanced UI in ReservationStatusDisplay for better user experience. - Improved saga log retrieval error handling. - Modified IReservationApiClient to return success status and HTTP code. - Simplified customer management in ReservationManager. - Updated cancellation process to handle already cancelled cases. - Enhanced overall structure and error handling in ReservationManager.
VenyaBrodetskiy
left a comment
There was a problem hiding this comment.
good!
mostly small comments, not urgent and not important.
! few important comments are about test files changes and test files in gitignore. Just don't know if everything is ok, or not, could you check please? that's the only reason why didn't approve yet
P.S
do you think upgrading dotnet can hold trialkit from upgrading to newer version of sagaway? some of their services still use dotnet 8, and some are already dotnet9
P.P.S
thinks to decide in future - maybe it is a good idea to move demo project outside of this repo in some other repo. but not now of course
| # Fody - auto-generated XML schema | ||
| FodyWeavers.xsd No newline at end of file | ||
| FodyWeavers.xsd | ||
| /Sagaway.IntegrationTests/Sagaway.IntegrationTests.TestProject/ApprovalFiles/test_a_1_failed_wait10_2_failed_b_1_success.received.txt |
There was a problem hiding this comment.
why tests results are in gitignore? is it right?
| [*time*][CallA]: Registering reminder CallA:Retry for CallA with interval 00:00:10 | ||
| [*time*]The Saga is deactivated. | ||
| [*time*]The Saga is activated. | ||
| [*time*][CallB]: CallB Success |
There was a problem hiding this comment.
are these changes ok?
| [*time*][CallA]: Wake by a reminder | ||
| [*time*][CallA]: OnReminderAsync: Validation for CallA returned false, retrying action. | ||
| [*time*][CallA]: CallA Failed. Retries exhausted. | ||
| [*time*][CallA]: CallA Success |
There was a problem hiding this comment.
are these changes ok?
| @@ -20,8 +20,6 @@ Saga Log: | |||
| [*time*][CallA]: Registering reminder CallA:Retry for Revert CallA with interval 00:00:05 | |||
| [*time*]The Saga is deactivated. | |||
| [*time*]The Saga is activated. | |||
There was a problem hiding this comment.
are these changes ok?
| CustomerName = _reservationInfo.CustomerName | ||
| }; | ||
|
|
||
| await _sagaResultPublisher.PublishMessageToSignalRAsync(sagaResult); |
There was a problem hiding this comment.
not very nice to do operations without catch in this block OnSagaCompletedAsync, because they will be unhandled, but for demo I don't think this is very important
| index index.html index.htm; | ||
|
|
||
| # Proxy API requests to the reservation-manager service | ||
| location /reserve { |
There was a problem hiding this comment.
do you really need to proxy_pass endpoint by endpoint here? might be easier to open everything. less secure, but for demo not critical.
but if you already did it, I don't think it worth investing any time, just wonder why
There was a problem hiding this comment.
don't like this file :DD
|
Test files are checked and ok
I thought about taking the Demo apart to a different solution, but maybe later.
.NET 9 is just for the Demo and tests, not for the core services, unless you find that it is different. It shouldn't affect Trialkit and Galleru
One thing that is different is that I upgraded to new Dapr, meaning that you must deploy a scheduler. Actually I do not know if ACA is compatible with the latest Dapr version.
If this answers your questions, can you accept the PR and create new packages?
________________________________
From: Venya Brodetskiy
Sent: Sunday, May 4, 2025 10:33 PM
To: Zio-Net/Sagaway
Cc: Alon Fliess; Author
Subject: Re: [Zio-Net/Sagaway] Update the Reservation Car Demo (PR #102)
@VenyaBrodetskiy commented on this pull request.
good!
mostly small comments, not urgent and not important.
! few important comments are about test files changes and test files in gitignore. Just don't know if everything is ok, or not, could you check please? that's the only reason why didn't approve yet
P.S
do you think upgrading dotnet can hold trialkit from upgrading to newer version of sagaway? some of their services still use dotnet 8, and some are already dotnet9
P.P.S
thinks to decide in future - maybe it is a good idea to move demo project outside of this repo in some other repo. but not now of course
________________________________
In .gitignore<#102 (comment)>:
\ No newline at end of file
+FodyWeavers.xsd
+/Sagaway.IntegrationTests/Sagaway.IntegrationTests.TestProject/ApprovalFiles/test_a_1_failed_wait10_2_failed_b_1_success.received.txt
why tests results are in gitignore? is it right?
________________________________
In Sagaway.IntegrationTests/Sagaway.IntegrationTests.TestProject/ApprovalFiles/test_a_1_failed_wait10_2_failed_b_1_success.approved.txt<#102 (comment)>:
@@ -12,16 +12,16 @@ Saga Log:
[*time*][CallA]: Registering reminder CallA:Retry for CallA with interval 00:00:10
[*time*]The Saga is deactivated.
[*time*]The Saga is activated.
+[*time*][CallB]: CallB Success
are these changes ok?
________________________________
In Sagaway.IntegrationTests/Sagaway.IntegrationTests.TestProject/ApprovalFiles/test_a_1_failed_wait5_2_success_b_1_failed_wait5_2_failed.approved.txt<#102 (comment)>:
@@ -24,9 +24,17 @@ Saga Log:
[*time*][CallB]: Registering reminder CallB:Retry for CallB with interval 00:00:30
[*time*]The Saga is deactivated.
[*time*]The Saga is activated.
-[*time*][CallA]: Wake by a reminder
-[*time*][CallA]: OnReminderAsync: Validation for CallA returned false, retrying action.
-[*time*][CallA]: CallA Failed. Retries exhausted.
+[*time*][CallA]: CallA Success
are these changes ok?
________________________________
In Sagaway.IntegrationTests/Sagaway.IntegrationTests.TestProject/ApprovalFiles/test_a_failed_on_2_no_callback_revert.approved.txt<#102 (comment)>:
@@ -20,8 +20,6 @@ Saga Log:
[*time*][CallA]: Registering reminder CallA:Retry for Revert CallA with interval 00:00:05
[*time*]The Saga is deactivated.
[*time*]The Saga is activated.
are these changes ok?
________________________________
In Sagaway.ReservationDemo/Sagaway.ReservationDemo.ReservationManager/Actors/CarReservation/CarReservationActor.cs<#102 (comment)>:
+ if (_reservationInfo == null)
+ {
+ _logger.LogWarning("Cannot save saga log: reservation info is null");
+ return;
+ }
+
+ var sagaResult = new SagaResult
+ {
+ ReservationId = _reservationInfo.ReservationId,
+ Outcome = "Reservation " + e.Status,
+ Log = e.Log,
+ CarClass = _reservationInfo.CarClass,
+ CustomerName = _reservationInfo.CustomerName
+ };
+
+ await _sagaResultPublisher.PublishMessageToSignalRAsync(sagaResult);
not very nice to do operations without catch in this block OnSagaCompletedAsync, because they will be unhandled, but for demo I don't think this is very important
________________________________
In Sagaway.ReservationDemo/Sagaway.ReservationDemo.ReservationUI/nginx.conf<#102 (comment)>:
@@ -0,0 +1,100 @@
+# /etc/nginx/conf.d/default.conf
+
+server {
+ listen 80;
+ server_name localhost;
+
+ # Root directory for Blazor app files
+ root /usr/share/nginx/html;
+ index index.html index.htm;
+
+ # Proxy API requests to the reservation-manager service
+ location /reserve {
do you really need to proxy_pass endpoint by endpoint here? might be easier to open everything. less secure, but for demo not critical.
but if you already did it, I don't think it worth investing any time, just wonder why
…________________________________
On Sagaway.ReservationDemo/Sagaway.ReservationDemo.ReservationUI/wwwroot/js/saga-log.js<#102 (comment)>:
don't like this file :DD
—
Reply to this email directly, view it on GitHub<#102 (review)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AAEHJJW2IF6VYYT5B3H6J2L24ZTQFAVCNFSM6AAAAAB4MIU452VHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZDQMJTGU2DANZSGQ>.
You are receiving this because you authored the thread.
|
PR Classification
Upgrade to .NET 9.0 and enhancements for reservation management and UI.
PR Summary
This pull request upgrades the project to .NET 9.0, improves reservation handling, and enhances the Blazor UI components for better user experience. Key changes include:
IntegrationTest.yaml: Updated .NET SDK version to 9.0.x and modified SignalR Dapr secret store.Dockerfile: Changed base image to .NET 9.0 for both build stages.Program.cs: Added methods for managing state and handling reservations.ReservationState.csandSignalRService.cs: Updated to include new properties and methods for reservations and messaging.App.razor,NavMenu.razor,MainLayout.razor): Improved user interface and functionalities for managing car reservations.