Pull new job from your tfk que
1.9K
Pulls next job from the saksbehandling queue and saves it as a .json-file in a directory of your choice.
It will save a copy of the file as well.
Sends statusupdate to the systemlog,
From npm
$ npm install tfk-saksbehandling-queue-pull
from github
$ git clone [email protected]:telemark/tfk-saksbehandling-queue-pull.git
cd into directory and run setup
$ npm run setup
'use strict'
const pullFromQueue = require('tfk-saksbehandling-queue-pull')
const options = {
key: 'NeverShareYourSecret',
payload: {
system: 'tfk-saksbehandling-queue-pull'
},
jobFolderPath: 'jobs/',
copiesFolderPath: 'copies/',
queueNextUrl: 'https://yoursystem.com/api/queue/next',
deleteFromQueueUrl: 'https://yoursystem.com/api/queue',
statusMessage: 'Ready for next step'
}
pullFromQueue(options, (error, data) => {
if (error) {
console.error(error)
} else {
console.log(data)
}
})
If no jobs in queue it returns
{ message: 'No job in queue' }
else
{ message: 'Job 56b79dc6139e6bf1069ae22d downloaded. Status updated.' }
Update docker.env
NODE_ENV=production
TFK_SQP_JWT_KEY=Louie Louie, oh no, I got to go. Louie Louie, oh no, I got to go
TFK_SQP_CALLBACK_STATUS_MESSAGE=Pending
TFK_SQP_JOB_DIRECTORY_PATH=test/data/jobs
TFK_SQP_COPIES_DIRECTORY_PATH=test/data/copies
TFK_SQP_QUEUE_NEXT_URL=https://example.com/api/queue/next
TFK_SQP_QUEUE_DELETE_URL=https://example.com/api/queue
Build
$ docker build -t tfk-saksbehandling-queue-pull .
$ docker run --env-file=docker.env --volume=/test/data/jobs:/src/test/data/jobs --rm tfk-saksbehandling-queue-pull
This will start a container. Download a job. Stop the container and remove it.

Content type
Image
Digest
Size
33.6 MB
Last updated
over 8 years ago
docker pull telemark/tfk-saksbehandling-queue-pull