Skip to content

Add Timer sample for monthly subscription - #112

Open
sachinsharma3191 wants to merge 1 commit into
temporalio:mainfrom
sachinsharma3191:sample/18-timer
Open

Add Timer sample for monthly subscription#112
sachinsharma3191 wants to merge 1 commit into
temporalio:mainfrom
sachinsharma3191:sample/18-timer

Conversation

@sachinsharma3191

Copy link
Copy Markdown

Summary

  • Adds a Timer sample implementing a monthly subscription workflow with cancellation handling (closes Sample request: Timer #18)
  • Uses Temporalio::Workflow.sleep for 30-day intervals and Temporalio::Workflow.execute_activity to charge the user
  • Handles Temporalio::Error::CanceledError for graceful workflow cancellation
  • Follows the .NET Timer sample reference pattern

Files

  • timer/subscription_workflow.rb — Subscription workflow with sleep loop and cancellation
  • timer/my_activities.rb — Simple Charge activity
  • timer/worker.rb — Worker registering workflow and activity
  • timer/starter.rb — Starts the subscription workflow
  • timer/README.md — Usage instructions
  • test/timer/subscription_workflow_test.rb — Time-skipping test verifying charge and cancellation
  • README.md — Added timer to the samples list

Test plan

  • Rubocop passes with no offenses
  • Time-skipping test passes (1 run, 2 assertions, 0 failures)

Implements issue temporalio#18 — a Timer sample matching the .NET reference.
Uses Temporalio::Workflow.sleep for 30-day intervals, charges via
an activity, and handles CanceledError for graceful cleanup.
Includes a time-skipping test.
@CLAassistant

CLAassistant commented Aug 12, 2026

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.


sachinsharma seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

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.

Sample request: Timer

2 participants