From 0eb647f161fbf1ef82c3d02450089b0e2845bf34 Mon Sep 17 00:00:00 2001 From: SH-Hong Date: Tue, 16 Apr 2024 09:24:52 +0000 Subject: [PATCH] GITBOOK-2: No subject --- gitbook/.gitbook/assets/Pulsecron_logo.png | Bin 0 -> 17472 bytes gitbook/README.md | 27 +++++ gitbook/SUMMARY.md | 25 +++++ gitbook/docs/creating-jobs/README.md | 4 + gitbook/docs/creating-jobs/create.md | 38 +++++++ gitbook/docs/creating-jobs/every.md | 42 ++++++++ gitbook/docs/creating-jobs/now.md | 35 +++++++ gitbook/docs/creating-jobs/schedule.md | 43 ++++++++ gitbook/docs/defining-job-processors.md | 58 +++++++++++ gitbook/docs/setup-and-config/README.md | 3 + .../docs/setup-and-config/config/README.md | 3 + .../config/defaultconcurrency.md | 31 ++++++ .../config/defaultlocklifetime.md | 32 ++++++ .../config/defaultlocklimit.md | 31 ++++++ .../docs/setup-and-config/config/locklimit.md | 31 ++++++ .../setup-and-config/config/maxconcurrency.md | 31 ++++++ gitbook/docs/setup-and-config/config/name.md | 26 +++++ .../setup-and-config/config/processevery.md | 29 ++++++ gitbook/docs/setup-and-config/config/sort.md | 31 ++++++ gitbook/docs/setup-and-config/connection.md | 55 ++++++++++ gitbook/quick-start.md | 96 ++++++++++++++++++ gitbook/why-pulse.md | 28 +++++ 22 files changed, 699 insertions(+) create mode 100644 gitbook/.gitbook/assets/Pulsecron_logo.png create mode 100644 gitbook/README.md create mode 100644 gitbook/SUMMARY.md create mode 100644 gitbook/docs/creating-jobs/README.md create mode 100644 gitbook/docs/creating-jobs/create.md create mode 100644 gitbook/docs/creating-jobs/every.md create mode 100644 gitbook/docs/creating-jobs/now.md create mode 100644 gitbook/docs/creating-jobs/schedule.md create mode 100644 gitbook/docs/defining-job-processors.md create mode 100644 gitbook/docs/setup-and-config/README.md create mode 100644 gitbook/docs/setup-and-config/config/README.md create mode 100644 gitbook/docs/setup-and-config/config/defaultconcurrency.md create mode 100644 gitbook/docs/setup-and-config/config/defaultlocklifetime.md create mode 100644 gitbook/docs/setup-and-config/config/defaultlocklimit.md create mode 100644 gitbook/docs/setup-and-config/config/locklimit.md create mode 100644 gitbook/docs/setup-and-config/config/maxconcurrency.md create mode 100644 gitbook/docs/setup-and-config/config/name.md create mode 100644 gitbook/docs/setup-and-config/config/processevery.md create mode 100644 gitbook/docs/setup-and-config/config/sort.md create mode 100644 gitbook/docs/setup-and-config/connection.md create mode 100644 gitbook/quick-start.md create mode 100644 gitbook/why-pulse.md diff --git a/gitbook/.gitbook/assets/Pulsecron_logo.png b/gitbook/.gitbook/assets/Pulsecron_logo.png new file mode 100644 index 0000000000000000000000000000000000000000..c1dd6c25b0235476386dfbc3df8aecd418d35cdc GIT binary patch literal 17472 zcmX6^by!qS7rq<7(%s!lNw=^|BOok|NGYkHA|N0jyGsj72q>LON~eObfOHE2A}tEi z(z*Nbd%i#JGxt8v+*8ysrwLS!aQwY~fVykk)&PK-1oF#!L;#@m{g$?dMIdPV z#q)Z5%k;IT(N8CoypqpJc_FKU35iZ%ECt^H2TqfCyYp$PZMai_b->S9e`|uNf7OkT z4YA)GEXz|wE4bd~S-o?80J1H2HRH|us#&HVMg}7#B~90sh1^>B;(mf}Q_Fg>)AFR* zeb;waZFieHYwq9t$&T{H#qn+?s~>CBD4WAw5*u>UTHTu*t63GU9K^hIBn!k)KUEfv zC~Xc3|5&|f*6NC^j<-tKY}J#kIj}vHn6qbZWtoyx!1}2Z`&Y+01=w?(98T9M#Biu^ zcPqqoO?RC~r2s&!Z;GGY{K$%pIEXn|~M zT}~SXmKT}OS4S)NxS>$!Dm0jV&HG^Mhi^QGTF^`|v_lL+(}MT@(zDAHpol~wF;Bc+ ziET0Edg0h1s2059*ZEW$8X6Qd>N%L3l_Sk}zpti?0OeZx2#ihT%1dpU5Z(U737)5h z!P#DfH8~=JkGDDs^%8DE|OcvX{E9Kox@t-BC*3$ zs=ujgzX)Xhd-9m@-rwO`y}w`N^UUOgo88({gMv6C3hDYj01;bNjGbsl8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1<+ld5arY}buO9Q&@qSd80>i=-*c?oOiGfjrX#Lp`-_j*{1XB=P2z&Cw zXDM%=hn8v+LQwz1g8Hv(M*YouCio0kvSj#^JmG%<0h0#$2{5TBumX3O-ChWOuZz4wv_{v`;#0~+)F$9*qM63QR&sPG32 zLx2;|EMRMenSdsOPzux4XF&8`?C|x+#V)^PM-X}s7%$}4^!?BRf)XeO7)p%REhC12 zieaky4M^aHprb9Hi0~Z`9(=E8Rru*=phaLCais)8WS}6BLcjx+fw(Pet^qdNAc22z ze-QYBp*;R5{99W3ImiK}1nvt=pgkayVL2*-Ga*_yC=~)e?h>Yef)4u+%P^g|MPY~i zhXSQ<6V%TC?pB4Leim{fm;;>$DS(A@fT2=YG?&Jr5o6Hpzwoi6e}RM>fdY;dbwa37 z$oam5GV?A7dPk9m_Gf+`91xU1d5}>As2FBu*#p(dTeb2=@B_LQLU^}C725fCLQZ%o z@(g(b0Rim=#`!Ci=yoCdP6ZG#c)-!4haVgqoO6W9DZ?T4Eg+yEptCRG><{!+cm5qvFvu*ZC$|G< zzXt&U0TV*m`NGKupLccgP58T@O^}KJHU!fkAfP$gDfs4hLI*%&$XFu$1njDy3<9Pz zq|o!P0z}__<&|P+{0Lje^qBSDAxd8$KrZC8^=WGiHcuYLp*a@M}{5{ZR zz&ZnADhx9YYdM28fJH}~53>jcLjh7i89+jwz+vG6KP=Yp7S59+j7MAIDs0J
+ +## **Definition and Context**: + +* Pulse is an open-source job scheduling tool in the Node.js ecosystem, serving as a fork of the discontinued Agenda project. +* Utilizes MongoDB for managing job data, which enhances its ability to perform at scale. + +## **Core Features**: + +* **High Scalability**: Handles numerous jobs efficiently, suitable for applications that need to manage extensive workloads. +* **Modern Architecture**: Leverages the latest Node.js features and incorporates best practices for optimal performance. +* **Flexible Scheduling**: Supports various types of job schedules, including complex cron patterns and one-time executions. +* **Seamless Integration**: Designed to integrate effortlessly with Node.js applications and existing MongoDB databases. + +## **Related Projects**: + +* [**pulsecron**](https://www.pulsecron.com): Provides an event-driven task scheduling management infrastructure. +* [**nestjs-pulse**](https://github.com/pulsecron/nestjs-pulse): An official NestJS module specifically tailored for integrating Pulse into NestJS applications. + +## **Usage and Application**: + +* Ideal for developers needing a reliable, scalable, and modern job scheduling solution. +* Applicable in scenarios ranging from simple task automation to complex job orchestration in distributed systems. diff --git a/gitbook/SUMMARY.md b/gitbook/SUMMARY.md new file mode 100644 index 0000000..565d325 --- /dev/null +++ b/gitbook/SUMMARY.md @@ -0,0 +1,25 @@ +# Table of contents + +* [What is Pulse?](README.md) +* [Why Pulse?](why-pulse.md) +* [Quick Start](quick-start.md) + +## DOCS + +* [Setup & Config](docs/setup-and-config/README.md) + * [Connection](docs/setup-and-config/connection.md) + * [Config](docs/setup-and-config/config/README.md) + * [Name](docs/setup-and-config/config/name.md) + * [ProcessEvery](docs/setup-and-config/config/processevery.md) + * [DefaultConcurrency](docs/setup-and-config/config/defaultconcurrency.md) + * [MaxConcurrency](docs/setup-and-config/config/maxconcurrency.md) + * [LockLimit](docs/setup-and-config/config/locklimit.md) + * [DefaultLockLimit](docs/setup-and-config/config/defaultlocklimit.md) + * [DefaultLockLifetime](docs/setup-and-config/config/defaultlocklifetime.md) + * [Sort](docs/setup-and-config/config/sort.md) +* [Defining Job Processors](docs/defining-job-processors.md) +* [Creating Jobs](docs/creating-jobs/README.md) + * [Every](docs/creating-jobs/every.md) + * [Schedule](docs/creating-jobs/schedule.md) + * [Now](docs/creating-jobs/now.md) + * [Create](docs/creating-jobs/create.md) diff --git a/gitbook/docs/creating-jobs/README.md b/gitbook/docs/creating-jobs/README.md new file mode 100644 index 0000000..dd006d5 --- /dev/null +++ b/gitbook/docs/creating-jobs/README.md @@ -0,0 +1,4 @@ +# Creating Jobs + + + diff --git a/gitbook/docs/creating-jobs/create.md b/gitbook/docs/creating-jobs/create.md new file mode 100644 index 0000000..1716b91 --- /dev/null +++ b/gitbook/docs/creating-jobs/create.md @@ -0,0 +1,38 @@ +# Create + + + +## `pulse.create(name, data?)` + +{% hint style="info" %} +The `create` method generates a new job instance based on a specified job type and data. It is a preliminary step in the job lifecycle, allowing for the customization of job parameters before the job is scheduled and executed.\ +\ +_This does **NOT** save the job in the database._ +{% endhint %} + +### Example Usage + +```typescript +cconst pulse = new Pulse(); + +// Create a new job for data analysis +const analysisJob = pulse.create('dataAnalysis', { datasetId: 101 }); +analysisJob.save() +``` + + + +#### Parameters + +* **`name`** (`string`): The name of the job to be created. This name should correspond to a job type previously defined with the `define` method, which dictates certain default settings such as priority and result-saving behavior. +* **`data`** (`T`): Data to pass to the job for its execution. This data is used within the job's processing logic and can be any type of data that the job requires. + +#### Returns + +* **`Job`**: Returns a new `Job` instance configured with the provided name and data. + +\ + + + + diff --git a/gitbook/docs/creating-jobs/every.md b/gitbook/docs/creating-jobs/every.md new file mode 100644 index 0000000..fd07baa --- /dev/null +++ b/gitbook/docs/creating-jobs/every.md @@ -0,0 +1,42 @@ +# Every + + + +## `pulse.every(interval, names, data?, options?)` + +{% hint style="info" %} +The `every` method schedules one or more jobs to run repeatedly at specified intervals. It allows for precise control over job execution timing and can be used to schedule routine tasks such as data synchronization, report generation, or regular maintenance tasks. +{% endhint %} + +### Example Usage + +```typescript +const pulse = new Pulse(); + +// Set a custom sort order for job processing +pulse.every('1 day', 'dailyReport', { reportId: 123 }); + +// Schedule multiple jobs to run every 30 minutes +pulse.every('30 minutes', ['updateCache', 'refreshData'], null, { skipImmediate: true }); +``` + + + +#### Parameters + +* **`interval`** (`string`): The interval at which the job(s) should run. This can be a human-readable format, such as '5 minutes', '1 hour', a [cron format](https://www.npmjs.com/package/cron-parser) `String`, or a `Number` +* **`names`** (`string | string[]`): The name or array of names of the job(s) to be scheduled. Each name corresponds to a job type previously defined with the `define` method. +* **`data`** (`T` - optional): Data to pass to the job when it runs. This could be any type of data required by the job for its execution. +* **`options`** (`JobOptions` - optional): Additional options for the job execution, such as starting the job at a specific time, setting a limit on the number of times the job should repeat, or other job-specific settings. + * **`timezone`** (`string` - optional): The timezone to use for scheduling the job, useful for jobs that depend on specific regional settings. + * **`startDate`** (`Date | number` - optional): The start date or timestamp from which the job should begin executing. _(_Only available when _interval format is a cron format)_ + * **`endDate`** (`Date | number` - optional): The end date or timestamp after which the job should no longer execute. _(_Only available when _interval format is a cron format)_ + * **`skipDays`** (`string` - optional): A string defining days to skip; used for creating more complex schedules. + * **`skipImmediate`** (`boolean` - optional): If set to true, skips the immediate first execution of the job schedule. + +#### Returns + +* **`Promise`**: A promise that resolves with the created job or jobs. The promise will resolve after the jobs have been scheduled, or it will reject if there is an error during scheduling. + + + diff --git a/gitbook/docs/creating-jobs/now.md b/gitbook/docs/creating-jobs/now.md new file mode 100644 index 0000000..698d892 --- /dev/null +++ b/gitbook/docs/creating-jobs/now.md @@ -0,0 +1,35 @@ +# Now + + + +## `pulse.now(name, data?)` + +{% hint style="info" %} +The `now` method schedules a job to be executed immediately. It creates a job instance and schedules it for the current time, allowing for rapid job processing. +{% endhint %} + +### Example Usage + +```typescript +cconst pulse = new Pulse(); + +// Schedule a job to run immediately to handle a high priority update +pulse.now('urgentUpdate', { updateDetails: 'Fix critical security issue' }) +``` + + + +#### Parameters + +* **`name`** (`string`): The name of the job to be scheduled. This name should correspond to a job type previously defined with the `define` method. +* **`data`** (`T` - optional): Data to pass to the job for its execution. This can be any type of data that the job requires to perform its tasks. + +#### Returns + +* **`Promise`**: A promise that resolves with the created job instance. This job is scheduled to start immediately unless the job queue is currently full or other jobs are already scheduled for the same time. + +\ + + + + diff --git a/gitbook/docs/creating-jobs/schedule.md b/gitbook/docs/creating-jobs/schedule.md new file mode 100644 index 0000000..06611f5 --- /dev/null +++ b/gitbook/docs/creating-jobs/schedule.md @@ -0,0 +1,43 @@ +# Schedule + + + +## `pulse.schedule(when, names, data?)` + +{% hint style="info" %} +The `schedule` method allows you to set a specific time for a job or multiple jobs to be executed. This is useful for tasks that must occur at precise times rather than at regular intervals. +{% endhint %} + +### Example Usage + +```typescript +cconst pulse = new Pulse(); + +// Schedule a single job to run next Monday at 9 AM +const nextMonday = new Date(); +nextMonday.setDate(nextMonday.getDate() + ((1 + 7 - nextMonday.getDay()) % 7 || 7)); +nextMonday.setHours(9, 0, 0, 0); + +pulse.schedule(nextMonday, 'weeklyMeetingReminder', { meetingId: 456 }); + +pulse.schedule('tomorrow at noon', [ + 'printAnalyticsReport', + 'sendNotifications', + 'updateUserRecords' +]); +``` + + + +#### Parameters + +* **`when`** (`string | Date`): The specific time when the job should be executed. This can be a string representing a date or a `Date` object. +* **`names`** (`string | string[]`): The name or array of names of the job(s) to be scheduled. Each name corresponds to a job type previously defined with the `define` method. +* **`data`** (`T` - optional): Data to pass to the job when it runs. This could be any type of data required by the job for its execution. + +#### Returns + +* **`Promise`**: A promise that resolves with the created job or jobs. The promise will resolve after the job has been scheduled, or it will reject if there is an error during scheduling. + + + diff --git a/gitbook/docs/defining-job-processors.md b/gitbook/docs/defining-job-processors.md new file mode 100644 index 0000000..edcba2d --- /dev/null +++ b/gitbook/docs/defining-job-processors.md @@ -0,0 +1,58 @@ +# Defining Job Processors + + + +## `pulse.define(name, processor, options)` + +{% hint style="info" %} +Before you can use a job, you must define its processing behavior. + +\ +The `define` method is used to configure how specific types of jobs should be handled by the `Pulse` instance. It allows you to specify a job's processing function and its operational parameters, such as concurrency limits, lock behaviors, and execution priority. +{% endhint %} + +### Example Usage + +```typescript +const pulse = new Pulse(); + +// Define a job type for sending emails +pulse.define('sendEmail', async (job, done) => { + try { + await sendEmail(job.data); + done(); // Mark the job as completed + } catch (error) { + console.error('Failed to send email:', error); + } +}, { + concurrency: 5, + lockLimit: 2, + priority: 'high', + lockLifetime: 300000, // 5 minutes + shouldSaveResult: true +}); + +``` + + + +#### Parameters + +* **`name`** (`string`): The unique name for the job type. This name is used to refer to and manage jobs of this type throughout their lifecycle. +* **`processor`** (`Processor`): The function that contains the logic to be executed when a job of this type is processed. The function receives a `Job` object and an optional `done` callback that should be called when the job processing completes. +* **`options`** (`DefineOptions` - optional): Configuration options for the job, which include: + * **`concurrency`** (`number`): Maximum number of instances of the job that can run simultaneously. Defaults to `Pulse`'s `_defaultConcurrency`. + * **`lockLimit`** (`number`): Maximum number of instances of the job that can be locked at once. Defaults to `Pulse`'s `_defaultLockLimit`. + * **`lockLifetime`** (`number`): Duration in milliseconds that the job remains locked (i.e., unavailable for re-processing) unless explicitly unlocked sooner. Defaults to `Pulse`'s `_defaultLockLifetime`. + * **`priority`** (`lowest|low|normal|high|highest|number`): The priority level of the job. Jobs with higher priority are processed first. Defaults to `normal`. + * **`shouldSaveResult`** (`boolean`): Indicates whether the result of the job processing should be saved. Defaults to `false`. + +\ + + +#### Returns + +* **`void`**: This method does not return a value. + + + diff --git a/gitbook/docs/setup-and-config/README.md b/gitbook/docs/setup-and-config/README.md new file mode 100644 index 0000000..fb80292 --- /dev/null +++ b/gitbook/docs/setup-and-config/README.md @@ -0,0 +1,3 @@ +# Setup & Config + +## diff --git a/gitbook/docs/setup-and-config/config/README.md b/gitbook/docs/setup-and-config/config/README.md new file mode 100644 index 0000000..4aabf8d --- /dev/null +++ b/gitbook/docs/setup-and-config/config/README.md @@ -0,0 +1,3 @@ +# Config + +pulse.name(name) diff --git a/gitbook/docs/setup-and-config/config/defaultconcurrency.md b/gitbook/docs/setup-and-config/config/defaultconcurrency.md new file mode 100644 index 0000000..29c571b --- /dev/null +++ b/gitbook/docs/setup-and-config/config/defaultconcurrency.md @@ -0,0 +1,31 @@ +# DefaultConcurrency + + + +## `pulse.defaultConcurrency(concurrency)` + +{% hint style="info" %} +The `defaultConcurrency` method sets the default number of jobs that can be processed concurrently by a `Pulse` instance. This setting is crucial for controlling how many jobs are run at the same time, affecting resource utilization and job throughput. +{% endhint %} + +### Example Usage + +```typescript +const pulse = new Pulse(); + +// Set the default concurrency for job processing to 3 +pulse.defaultConcurrency(3); +``` + + + +#### Parameters + +* **`concurrency`** (`number`): The default number of concurrent jobs that the system should process. This value sets a baseline for job processing unless explicitly overridden by specific jobs. + +#### Returns + +* **`Pulse`**: Returns the `Pulse` instance, allowing for chaining of additional method calls. + + + diff --git a/gitbook/docs/setup-and-config/config/defaultlocklifetime.md b/gitbook/docs/setup-and-config/config/defaultlocklifetime.md new file mode 100644 index 0000000..d7f6def --- /dev/null +++ b/gitbook/docs/setup-and-config/config/defaultlocklifetime.md @@ -0,0 +1,32 @@ +# DefaultLockLifetime + + + +## `pulse.defaultLockLifetime(ms)` + +{% hint style="info" %} +The `defaultLockLifetime` method sets the default duration (in milliseconds) that a job can remain locked during processing before it is automatically released. This setting helps manage job recovery and ensures that jobs do not remain locked indefinitely if an error occurs or if the job processing is not completed as expected. +{% endhint %} + +### Example Usage + +```typescript +const pulse = new Pulse(); + +// Set the default lock lifetime to 5 minutes (300000 ms) +pulse.defaultLockLifetime(300000); +``` + + + +#### Parameters + +* **`ms`** (`number`): The duration in milliseconds for how long jobs should be locked by default. + * default: 600,000ms + +#### Returns + +* **`Pulse`**: Returns the instance of the `Pulse` class, allowing for method chaining. + + + diff --git a/gitbook/docs/setup-and-config/config/defaultlocklimit.md b/gitbook/docs/setup-and-config/config/defaultlocklimit.md new file mode 100644 index 0000000..f4054bb --- /dev/null +++ b/gitbook/docs/setup-and-config/config/defaultlocklimit.md @@ -0,0 +1,31 @@ +# DefaultLockLimit + + + +## `pulse.defaultLockLimit(times)` + +{% hint style="info" %} +The `defaultLockLimit` method sets the default number of times jobs of any given type can be locked concurrently. This setting helps to manage the concurrency of job processing more finely by limiting how many instances of the same job type can be prepared for execution at the same time. +{% endhint %} + +### Example Usage + +```typescript +const pulse = new Pulse(); + +// Set the default concurrency for job processing to 3 +pulse.defaultLockLimit(2); +``` + + + +#### Parameters + +* **`times`** (`number`): The maximum number of times jobs of a specific type can be locked concurrently. + +#### Returns + +* **`Pulse`**: Returns the instance of the `Pulse` class, allowing for method chaining. + + + diff --git a/gitbook/docs/setup-and-config/config/locklimit.md b/gitbook/docs/setup-and-config/config/locklimit.md new file mode 100644 index 0000000..8005674 --- /dev/null +++ b/gitbook/docs/setup-and-config/config/locklimit.md @@ -0,0 +1,31 @@ +# LockLimit + + + +## `pulse.lockLimit(limit)` + +{% hint style="info" %} +The `lockLimit` method sets the maximum number of jobs that can be locked by the `Pulse` instance at any one time. This is a global setting affecting all job processing, helping to control job concurrency and prevent overload. +{% endhint %} + +### Example Usage + +```typescript +const pulse = new Pulse(); + +// Set a global lock limit to prevent too many jobs from being locked at the same time +pulse.lockLimit(5); +``` + + + +#### Parameters + +* **`limit`** (`number`): The maximum number of jobs that can be locked simultaneously across the system. + +#### Returns + +* **`Pulse`**: Returns the `Pulse` instance, enabling method chaining. + + + diff --git a/gitbook/docs/setup-and-config/config/maxconcurrency.md b/gitbook/docs/setup-and-config/config/maxconcurrency.md new file mode 100644 index 0000000..0d0b825 --- /dev/null +++ b/gitbook/docs/setup-and-config/config/maxconcurrency.md @@ -0,0 +1,31 @@ +# MaxConcurrency + + + +## `pulse.maxConcurrency(concurrency)` + +{% hint style="info" %} +The `maxConcurrency` method sets the maximum number of jobs that can be processed concurrently across the entire `Pulse` instance, regardless of job type. This global setting is crucial for controlling overall system load and ensuring that job processing does not overwhelm system resources. +{% endhint %} + +### Example Usage + +```typescript +const pulse = new Pulse(); + +// Set the default concurrency for job processing to 3 +pulse.maxConcurrency(10); +``` + + + +#### Parameters + +* **`concurrency`** (`number`): The maximum number of concurrent jobs allowed. This setting applies to all job types handled by the `Pulse` instance. + +#### Returns + +* **`Pulse`**: Returns the instance of the `Pulse` class, enabling method chaining. + + + diff --git a/gitbook/docs/setup-and-config/config/name.md b/gitbook/docs/setup-and-config/config/name.md new file mode 100644 index 0000000..fe4438f --- /dev/null +++ b/gitbook/docs/setup-and-config/config/name.md @@ -0,0 +1,26 @@ +# Name + + + +## `pulse.name(name)` + +{% hint style="info" %} +The `name` method of the `Pulse` class allows setting or updating the name of the job queue. This name can be used for identification and management purposes within applications that may handle multiple queues. +{% endhint %} + +### Example Usage + +```typescript +const pulse = new Pulse(); +pulse.name('emailProcessingQueue'); +``` + +#### Parameters + +* **`name`** (`string`): The name to assign to the Pulse instance's job queue. + +#### Returns + +* **`Pulse`**: Returns the instance of the `Pulse` class, allowing for method chaining. + +#### diff --git a/gitbook/docs/setup-and-config/config/processevery.md b/gitbook/docs/setup-and-config/config/processevery.md new file mode 100644 index 0000000..e706dda --- /dev/null +++ b/gitbook/docs/setup-and-config/config/processevery.md @@ -0,0 +1,29 @@ +# ProcessEvery + + + +## `pulse.processEvery(interval)` + +{% hint style="info" %} +The `name` method of the `Pulse` class allows setting or updating the name of the job queue. This name can be used for identification and management purposes within applications that may handle multiple queues. +{% endhint %} + +### Example Usage + +```typescript +const pulse = new Pulse(); + +// Configure the job processing interval to every 10 minutes +pulse.processEvery('10 minutes'); +``` + + + +#### Parameters + +* **`interval`** (`string`): The interval at which to process jobs, expressed in a human-readable format, such as '5 minutes', '1 hour', etc. + +#### Returns + +* **`Pulse`**: Returns the instance of the `Pulse` class, facilitating method chaining. + diff --git a/gitbook/docs/setup-and-config/config/sort.md b/gitbook/docs/setup-and-config/config/sort.md new file mode 100644 index 0000000..c2d4f62 --- /dev/null +++ b/gitbook/docs/setup-and-config/config/sort.md @@ -0,0 +1,31 @@ +# Sort + + + +## `pulse.sort(query)` + +{% hint style="info" %} +The `sort` method customizes the sorting order of jobs when querying the MongoDB database. This order can significantly affect the efficiency and priority with which jobs are processed. +{% endhint %} + +### Example Usage + +```typescript +const pulse = new Pulse(); + +// Set a custom sort order for job processing +pulse.sort({ createdAt: -1 }); +``` + + + +#### Parameters + +* **`query`** (`object`): A MongoDB sort query object that specifies how to order the jobs. For example, `{ nextRunAt: 1, priority: -1 }` will sort jobs primarily by their next scheduled run time in ascending order and by priority in descending order if there are ties. + +#### Returns + +* **`Pulse`**: Returns the instance of the `Pulse` class, enabling method chaining. + + + diff --git a/gitbook/docs/setup-and-config/connection.md b/gitbook/docs/setup-and-config/connection.md new file mode 100644 index 0000000..8ad2666 --- /dev/null +++ b/gitbook/docs/setup-and-config/connection.md @@ -0,0 +1,55 @@ +# Connection + +The MongoDB connection can be configured through the `PulseConfig` object, which supports either direct client reuse or new connection parameters. + + + +#### Example Usage + +```typescript +const pulseConfig = { + processEvery: '1 minute', + maxConcurrency: 10, + db: { + address: 'mongodb://localhost:27017/myApp', + collection: 'jobQueue' + } +}; + + + +const pulse = new Pulse(pulseConfig, (error, collection) => { + if (error) { + console.error('Connection error:', error); + } else { + console.log('Connected to MongoDB collection:', collection.collectionName); + } +}); +``` + + + + + +### `new Pulse(config?, cb?)` + +#### Parameters + +* **`config`** + * **`name`** (`string` - optional): Specifies the name of the job queue. This can be used for identifying and managing different queues within the same application. + * **`processEvery`** (`string` - optional): Defines how often the job processor should poll for new jobs to process. The string should be a human-readable interval, such as `'5 minutes'`, `'1 hour'`. Defaults to `'5 seconds'` if not specified. + * **`maxConcurrency`** (`number` - optional): The maximum number of jobs that can be processed concurrently. Helps in controlling resource utilization. + * **`defaultConcurrency`** (`number` - optional): The default concurrency for jobs that do not specify their own concurrency setting. + * **`lockLimit`** (`number` - optional): Maximum number of jobs that can be locked at the same time. This prevents a single worker from locking too many jobs. + * **`defaultLockLimit`** (`number` - optional): Default limit for the number of jobs each worker can lock simultaneously. + * **`defaultLockLifetime`** (`number` - optional): Duration in milliseconds for how long a job can be locked before it is automatically unlocked. Useful for handling job crashes or stalls. Defaults to 600000 ms (10 minutes). + * **`sort`** (`any` - optional): Determines the order in which jobs are selected and locked from the database. For example, `{ nextRunAt: 1, priority: -1 }` sorts by `nextRunAt` ascending and `priority` descending. + * **`mongo`** (`MongoDb` - optional): An existing MongoDB client that can be reused instead of creating a new connection. + * **`db`** (`object` - optional): Configuration for the MongoDB connection if not using an existing `MongoDb` client. Includes: + * **`address`** (`string`): The MongoDB connection URI. + * **`collection`** (`string` - optional): Specifies the MongoDB collection to use. Defaults to `pulseJobs`. + * **`options`** (`MongoClientOptions` - optional): MongoDB client options. + * **`disableAutoIndex`** (`boolean` - optional): If set to `true`, automatic indexing of job fields by the `Pulse` system is disabled. Useful for performance tuning in production environments. + + + diff --git a/gitbook/quick-start.md b/gitbook/quick-start.md new file mode 100644 index 0000000..f3942d5 --- /dev/null +++ b/gitbook/quick-start.md @@ -0,0 +1,96 @@ +# Quick Start + +### Installation + +```bash +npm i @pulsecron/pulse +``` + + + +### Example + +```typescript +import Pulse from '@pulsecron/pulse'; + +const mongoConnectionString = 'mongodb://localhost:27017/pulse'; + +const pulse = new Pulse({ db: { address: mongoConnectionString } }); + +// Or override the default collection name: +// const pulse = new Pulse({db: {address: mongoConnectionString, collection: 'jobCollectionName'}}); + +// or pass additional connection options: +// const pulse = new Pulse({db: {address: mongoConnectionString, collection: 'jobCollectionName', options: {ssl: true}}}); + +// or pass in an existing mongodb-native MongoClient instance +// const pulse = new Pulse({mongo: myMongoClient}); + +/** + * Example of defining a job + */ +pulse.define('delete old users', async (job) => { + console.log('Deleting old users...'); + return; +}); + +/** + * Example of repeating a job + */ +(async function () { + // IIFE to give access to async/await + await pulse.start(); + + await pulse.every('3 minutes', 'delete old users'); + + // Alternatively, you could also do: + await pulse.every('*/3 * * * *', 'delete old users'); +})(); + +/** + * Example of defining a job with options + */ +pulse.define( + 'send email report', + async (job) => { + const { to } = job.attrs.data; + + console.log(`Sending email report to ${to}`); + }, + { lockLifetime: 5 * 1000, priority: 'high', concurrency: 10 } +); + +/** + * Example of scheduling a job + */ +(async function () { + await pulse.start(); + await pulse.schedule('in 20 minutes', 'send email report', { to: 'admin@example.com' }); +})(); + +/** + * Example of repeating a job + */ +(async function () { + const weeklyReport = pulse.create('send email report', { to: 'example@example.com' }); + await pulse.start(); + await weeklyReport.repeatEvery('1 week').save(); +})(); + +/** + * Check job start and completion/failure + */ +pulse.on('start', (job) => { + console.log(time(), `Job <${job.attrs.name}> starting`); +}); +pulse.on('success', (job) => { + console.log(time(), `Job <${job.attrs.name}> succeeded`); +}); +pulse.on('fail', (error, job) => { + console.log(time(), `Job <${job.attrs.name}> failed:`, error); +}); + +function time() { + return new Date().toTimeString().split(' ')[0]; +} +``` diff --git a/gitbook/why-pulse.md b/gitbook/why-pulse.md new file mode 100644 index 0000000..a655197 --- /dev/null +++ b/gitbook/why-pulse.md @@ -0,0 +1,28 @@ +# Why Pulse? + +
+ +## **Continuation of Agenda**: + +* Pulse is developed as a continuation of the popular Agenda project, which is no longer actively maintained. +* Recognizing the gap left in the Node.js ecosystem, Pulse aims to provide ongoing support and enhancements for job scheduling needs. + +## **Advanced Functionalities**: + +* Introduces new features that tackle complex scheduling challenges more effectively than its predecessor. +* Designed with modern requirements in mind, ensuring that it remains a relevant tool for developers. + +## **Improved Scalability**: + +* Built to handle large-scale job processing more efficiently, accommodating growing application demands. +* Optimized for performance, making it suitable for high-load environments. + +## **Integration and Flexibility**: + +* Offers seamless integration with existing Node.js applications and MongoDB, reducing the learning curve and implementation effort. +* Supports a variety of job types including cron, one-time, and recurring jobs with enhanced control over scheduling. + +## **Community and Support**: + +* Backed by a community of developers who are committed to maintaining and expanding its capabilities. +* Provides extensive documentation and examples to help users get started and maximize their use of the tool.