Skip to content

Added Standalone Activities sample#462

Merged
maciejdudko merged 6 commits intotemporalio:mainfrom
maciejdudko:standalone-activities
May 5, 2026
Merged

Added Standalone Activities sample#462
maciejdudko merged 6 commits intotemporalio:mainfrom
maciejdudko:standalone-activities

Conversation

@maciejdudko
Copy link
Copy Markdown
Contributor

Added sample demonstrating use of Standalone Activities APIs.

@maciejdudko maciejdudko requested a review from a team as a code owner May 1, 2026 21:47
@maciejdudko maciejdudko force-pushed the standalone-activities branch from a9f98b2 to 0de0501 Compare May 5, 2026 07:26
Comment on lines +12 to +20
const { count } = await client.activity.count(query);
console.log(`Total activities: ${count}`);

console.log('ACTIVITY ID | RUN ID | ACTIVITY TYPE | STATUS | COMPLETED TIME');

for await (const a of client.activity.list(query)) {
console.log(
`${a.activityId} | ${a.activityRunId} | ${a.activityType} | ${a.status} | ${a.closeTime?.toISOString()}`,
);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nit: is there a reason we don't do:

const listActivities = await client.activity.list(query);
console.log(`Total activities: ${listActivities.length});

console.log('ACTIVITY ID | RUN ID | ACTIVITY TYPE | STATUS | COMPLETED TIME');

for (const a of listActivities) { ... }  

Could be TOCTOU between client.activity.count and client.activity.list

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

We are demonstrating both the list and the count APIs.

@maciejdudko maciejdudko merged commit 7592c89 into temporalio:main May 5, 2026
13 checks passed
@maciejdudko maciejdudko deleted the standalone-activities branch May 5, 2026 16:55
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.

2 participants