Skip to content

feat: add jobs #688

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

Draft
wants to merge 33 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
f4038ef
Rough-in the contracts.
atrauzzi Mar 15, 2025
0863694
Implement registration.
atrauzzi Mar 15, 2025
492bad9
Implement the rest of the jobs utility methods.
atrauzzi Mar 15, 2025
591386d
Cleanup.
atrauzzi Mar 15, 2025
eac5fb6
Cleanup.
atrauzzi Mar 16, 2025
70b388b
Temporarily disable some eslint checks for builds.
atrauzzi Mar 17, 2025
2a08aa7
Mimic the cron expression from the dotnet library.
atrauzzi Mar 18, 2025
46be05e
Rename each to every.
atrauzzi Mar 18, 2025
110ee6f
Expanding things.
atrauzzi Mar 18, 2025
00e588d
Change case of static method.
atrauzzi Mar 18, 2025
fa6682f
Cleaning up, getting ready for some regex-fu.
atrauzzi Mar 18, 2025
2fb1bc6
Crons make me sad.
atrauzzi Mar 20, 2025
a221e35
All crons and regex...
atrauzzi Mar 21, 2025
f2e9343
Exploring an e2e approach.
atrauzzi Mar 22, 2025
4708b0d
Cleaning.
atrauzzi Mar 22, 2025
263a6c2
Remove prettifier from build (#684)
WhitWaldo Mar 24, 2025
9b80405
Removed references to Workflow components (#687)
WhitWaldo Mar 26, 2025
b2ef118
Removes stale bot from repo (#690)
WhitWaldo Mar 26, 2025
8feccb1
WIP
atrauzzi Apr 20, 2025
9e28846
Apply: https://github.com/dapr/js-sdk/pull/688/files#r2008853805
atrauzzi Apr 20, 2025
327f439
WIP
atrauzzi Apr 21, 2025
355db1c
WIP
atrauzzi Apr 21, 2025
3f9ae60
chore: update dependencies (#699)
joebowbeer May 27, 2025
4586f4a
Triggers once.
atrauzzi Jun 13, 2025
7d31554
WIP
atrauzzi Jul 11, 2025
aa2038f
A few hours and some caffeine later... We got it!
atrauzzi Jul 12, 2025
7890ec5
Clean up.
atrauzzi Jul 12, 2025
dd20d6c
Merge branch 'main' into add-jobs
atrauzzi Jul 12, 2025
225ae32
Add test for removing a job.
atrauzzi Jul 13, 2025
96c3ade
Merge branch 'main' into add-jobs
atrauzzi Jul 13, 2025
74a3f99
Cleanup and stub some basic docs.
atrauzzi Jul 13, 2025
3efe072
Merge branch 'main' into add-jobs
WhitWaldo Aug 13, 2025
17852f6
Fix up and add tests for prepare day of week value list.
atrauzzi Aug 14, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 56 additions & 1 deletion daprdocs/content/en/js-sdk-docs/js-server/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ const daprServer = new DaprServer({
serverPort: "50002", // App Port
serverHttp: myApp,
clientOptions: {
daprHost
daprHost,
daprPort
}
});
Expand Down Expand Up @@ -562,6 +562,61 @@ async function start() {
}
```

### Jobs API

The [jobs API](https://docs.dapr.io/developing-applications/building-blocks/jobs/jobs-overview/) allows you to schedule actions for dapr to invoke at some later point.

#### Schedule Job

Using the dapr client, you can have your application called with a desired payload at specific time(s).

```typescript
const client = new DaprClient({
daprHost: daprHost,
daprPort: daprPort,
communicationProtocol: CommunicationProtocolEnum.HTTP,
});

await client.jobs.schedule(
"my-job",
{ value: "hello world" },
"* * * * * *"
);
```

Dapr will call your application at `/job/{nameOfJob}` according to the cron expression
provided when registered. Using the example above, that would be `/job/my-job`.

### Get Job

You can retrieve information about a registered job by calling the `get` method.

```typescript
const client = new DaprClient({
daprHost: daprHost,
daprPort: daprPort,
communicationProtocol: CommunicationProtocolEnum.HTTP,
});

await client.jobs.get("my-job");
```

The result is the payload provided when the job was registered, inside a `Job` wrapper instance.

#### Delete Job

If you wish to cancel any registered job, you can use the delete method found on the client:

```typescript
const client = new DaprClient({
daprHost: daprHost,
daprPort: daprPort,
communicationProtocol: CommunicationProtocolEnum.HTTP,
});

await client.jobs.delete("my-job");
```

### Bindings API

#### Receive an Input Binding
Expand Down
Loading
Loading