1.0.22 • Published 12 months ago
@enschedule/hub v1.0.22
worker
Docker
Environment variables
DB_USER DB_HOST DB_PASSWORD DB_DATABASE DB_PORT ENSCHEDULE_API REGISTER_JOBS_SCRIPT ENSCHEDULE_API_PORT or default is 8080 ENSCHEDULE_API_HOSTNAME or undefined
Usage
Use the image as is:
cat <<EOC > index.js
const { z } = require('zod');
module.exports = async (worker) => {
worker.registerJob({
id: 'log-job',
title: 'Log message',
dataSchema: z.object({
message: z.string(),
}),
job: async (data, console) => {
console.log(data.message);
},
description: 'Will print the message on the server',
example: {
message: 'some message',
},
});
}
EOCdocker container run -p 8080:8080 -e API_ENDPOINT=true -v ${PWD}:/enschedule/jobs enschedule:latestAPI
Usage
import { Worker } from '@enschedule/worker';
const worker = new Worker({});
void (async () => {
worker.registerJob({
id: 'log-job',
title: 'Log message',
dataSchema: z.object({
message: z.string(),
}),
job: async (data, console) => {
console.log(data.message);
},
description: 'Will print the message on the server',
example: {
message: 'some message',
},
});
await worker.startPolling();
if (process.env.ENSCHEDULE_API) {
worker.serve({ port: 8080 }).listern();
}
})();1.0.19
1 year ago
1.0.2
1 year ago
1.0.18
1 year ago
1.0.1
1 year ago
1.0.17
1 year ago
1.0.0
1 year ago
1.0.9
1 year ago
1.0.8
1 year ago
1.0.7
1 year ago
1.0.6
1 year ago
1.0.5
1 year ago
1.0.4
1 year ago
1.0.3
1 year ago
1.0.22
12 months ago
1.0.21
1 year ago
1.0.10
1 year ago
1.0.20
1 year ago
1.0.15
1 year ago
1.0.14
1 year ago
1.0.13
1 year ago
1.0.12
1 year ago
0.0.1
1 year ago