docs: update scheduled jobs docs (#7905)
- Update scheduled jobs docs to support updated definition + remove coming soon notice - Update scheduled jobs everywhere else they're used.
This commit is contained in:
1 parent
6cb28eedf7
commit
0aeba83a66
7 files changed
+104
-74
No files matched your search
@@ -163,7 +163,7 @@ In this document, you’ll find common examples of how you can use the Pricing M
|
||||
} from "@medusajs/pricing"
|
||||
|
||||
export async function GET(
|
||||
request: Request,
|
||||
request: Request
|
||||
) {
|
||||
const pricingModuleService = await initializePricingModule()
|
||||
|
||||
@@ -381,7 +381,7 @@ In this document, you’ll find common examples of how you can use the Pricing M
|
||||
} from "@medusajs/pricing"
|
||||
|
||||
export async function GET(
|
||||
request: Request,
|
||||
request: Request
|
||||
) {
|
||||
const pricingModuleService = await initializePricingModule()
|
||||
|
||||
|
||||
@@ -436,19 +436,13 @@ Medusa also provides Notification Module Providers that integrate with third-par
|
||||
|
||||
As your commerce store grows, you'll likely need to synchronize data across different systems. For example, you need to synchronize data with an ERP system or a data warehouse.
|
||||
|
||||
You can do that by:
|
||||
To implement that:
|
||||
|
||||
- Creating a workflow that implements the synchronization steps, along with retry and rollback logic.
|
||||
- Creating a scheduled job that executes the workflow automatically at the specified time pattern.
|
||||
|
||||
<Note type="soon">
|
||||
|
||||
Scheduled jobs are coming soon.
|
||||
|
||||
</Note>
|
||||
- Create a workflow that implements the synchronization steps, along with retry and rollback logic.
|
||||
- Create a scheduled job that executes the workflow automatically at the specified time pattern.
|
||||
|
||||
<Card
|
||||
href="#"
|
||||
href="!docs!/basics/scheduled-jobs"
|
||||
title="Create a Scheduled Job"
|
||||
text="Learn how to create a scheduled job in Medusa."
|
||||
startIcon={<AcademicCapSolid />}
|
||||
@@ -633,6 +627,33 @@ export const syncProductsWorkflowHighlight = [
|
||||
3. Sync the retrieved products with a third-party service. It's assumed that the connection to the third-party service is implemented within a custom module's main service.
|
||||
4. Update the last sync date of the store to the current date.
|
||||
|
||||
Then, create a scheduled job at `src/jobs/sync-products.ts` that executes the workflow at the specified interval:
|
||||
|
||||
```ts
|
||||
import { MedusaContainer } from "@medusajs/types"
|
||||
import {
|
||||
syncProductsWorkflow,
|
||||
} from "../workflows/sync-products"
|
||||
|
||||
export default async function syncProductsJob(
|
||||
container: MedusaContainer
|
||||
) {
|
||||
await syncProductsWorkflow(container)
|
||||
.run({
|
||||
input: {
|
||||
name: "John",
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
export const config = {
|
||||
name: "sync-products",
|
||||
// execute every minute
|
||||
schedule: "0 0 * * *",
|
||||
numberOfExecutions: 3,
|
||||
}
|
||||
```
|
||||
|
||||
</Details>
|
||||
|
||||
---
|
||||
@@ -842,12 +863,6 @@ To do that, create a subscriber that listens to the `product.created`, and send
|
||||
|
||||
You can also create a scheduled job that checks whether the number of new products has exceeded a set threshold, then sends out the newsletter.
|
||||
|
||||
<Note type="soon">
|
||||
|
||||
Scheduled jobs are coming soon.
|
||||
|
||||
</Note>
|
||||
|
||||
<CardList items={[
|
||||
{
|
||||
href: "!docs!/basics/events-and-subscribers",
|
||||
|
||||
@@ -80,7 +80,6 @@ Implementing the logic depends on your use case, but you'll mainly implement the
|
||||
<Note type="soon">
|
||||
|
||||
- The `order.placed` event isn't emitted yet.
|
||||
- Scheduled jobs are coming soon.
|
||||
|
||||
</Note>
|
||||
|
||||
|
||||
Reference in new issue
Block a user