Skip to content
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

How to run agenda as client? #190

Closed
vijaybarnwal opened this issue Aug 25, 2015 · 2 comments
Closed

How to run agenda as client? #190

vijaybarnwal opened this issue Aug 25, 2015 · 2 comments
Labels

Comments

@vijaybarnwal
Copy link

vijaybarnwal commented Aug 25, 2015

Hi,

I have two files in which one is used as a client and other is for saving jobs in db which is listed below:

Agenda Client side code which is used for creating/saving jobs into mongodb:

var Agenda = require('agenda');
var agenda = new Agenda({db: {address: 'localhost:27017/cronjobs'}});
agenda.purge(function () {
    console.log("pr");
});
var job = agenda.create('delete old users', {'test': 'test'});
job.repeatEvery('10 seconds');
job.save();

Agenda running on serverside with agenda-ui:

var express = require('express');
var Agenda = require('agenda');
var agendaUI = require('agenda-ui');
var app = express();
var agenda = new Agenda({db: {address: 'localhost:27017/cronjobs'}});
console.log('here inside interval');
app.use('/agenda-ui', agendaUI(agenda, {poll: 1000}));
agenda.jobs({}, function(err, jobs) {
    console.log(jobs);
});
agenda.start();
app.listen(3022);

Actually I want to start agenda as independent from creating or defining job where its connecting with db and run the jobs stored inside mongodb.

But after running above piece of code I am not able to run jobs as repeated mode or as scheduler.

Please help.

Thanks,
Vijay

@nwkeeley
Copy link
Member

No where in the above code do I see that you have defined a task definition for 'delete old users'

@OmgImAlexis
Copy link
Member

Since this has had no reply in over a year I'm closing it. If this is still an issue please let us know so it can be reopened.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants