-
Notifications
You must be signed in to change notification settings - Fork 6
Added examples. #5
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
Conversation
This commit adds two comprehensive examples showcasing the Swift Temporal SDK: 1. **MultipleActivities Example**: Demonstrates activity orchestration through a realistic e-commerce order fulfillment workflow with six sequential steps (inventory check, payment processing, reservation, shipment creation, customer notification, and status update). Each activity uses tailored retry policies appropriate for its operation type. 2. **ErrorHandling Example**: Showcases error handling and compensation patterns through a travel booking workflow with three scenarios: - Retry with exponential backoff for transient failures - Saga pattern for successful distributed transaction compensation - Workflow failure when compensation itself fails Both examples follow Temporal best practices: - Structured Codable types (no string parsing or tuple encoding) - Deterministic workflows (no print statements in workflow code) - Realistic business scenarios demonstrating SDK value - Clear retry policies and error handling patterns - Temporal UI links for easy workflow monitoring 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Hey Shy - adding in the executable targets for the examples makes them super easy access, but comes at the cost of extending the build time for the project overall, which may be undesirable. A pattern that I've seen used in the broader Swift ecosystem is to make a separate Swift package manifest in an This'll also sort some of the breaking tests that are complaining about public API changes. If you head this direction, it might be worth adding some additional CI build checks to verify that the examples all compile correctly, since that wouldn't normally be verified with a top-level package build if it's a separate package. The last suggestion is taking a quick peek and run through a compilation run on Linux, where some of the Foundation types (URLSession, in particular) have some different "API shapes" that look to be causing some compilation issues. I used The command, for reference (it's my handy go-to check a Linux compilation), referencing container: container run -it -c 4 -m 8g -v "$(pwd):/src" -w src/ swift:6.2-noble The other technique I like to use to check package builds in Linux is a bit larger in terms of moving parts - setting up a .devContainer for the repository, and opening it in VS Code. You can see the full set of issues that don't compile in Linux in the complication checks in GH Actions, but a short snippet to illustrate from my local build as well:
Functionally, I thought all the examples were easy to read and parse through. For me, I'd tend to lean a bit into a touch more narrative content - working to make full sentences rather than leaning on fragments and such, but it's perfectly clear and the differences between examples are easy to understand, and - I think - from the examples you provide, understand "Ah, this is the pattern to do... XYZ" |
@heckj Thanks for the feedback. This is very much appreciated. I've added in a new package.swift for the examples directory. I've also resolved the linux build issues and confirm everything works with the command you shared. Franz has asked to let him handle the CI build checks so I'll leave those alone for now. |
This commit adds 5 examples: