Skip to content

uberall/jesque-admin

Repository files navigation

jesque-admin

A User interface for Jesque powered by grails and react.

Installation

Just add jesque-admin to your dependencies

dependencies {
    ...
    compile 'org.grails.plugins:jesque-admin:0.6.6'
}

Usage

Make sure that jesque is enabled. If you do not have the "default mapping for controllers" in your UrlMappings.groovy you will have to add mappings for jesque-admin to your UrlMappings.groovy This plugin does not expose any UrlMappings by itself for security reasons. Job payloads can hold sensitive data and having an "open" jesque-admin interface can lead to breaches.

"/jesque/"(controller: 'jesqueAdmin', action: 'index')
"/jesque/api/overview"(controller: 'jesqueAdmin', action: 'overview')
"/jesque/api/queues"(controller: 'jesqueAdminQueue', action: 'list')
"/jesque/api/queues/$name"(controller: 'jesqueAdminQueue', action: 'details', method: "GET")
"/jesque/api/queues/$name"(controller: 'jesqueAdminQueue', action: 'remove', method: "DELETE")
"/jesque/api/jobs"(controller: 'jesqueAdminStatistics', action: 'jobs', method: "GET")
"/jesque/api/jobs"(controller: 'jesqueAdminJob', action: 'enqueue', method: "POST")
"/jesque/api/jobs/removeDelayed"(controller: 'jesqueAdminJob', action: 'removeDelayed', method: "POST")
"/jesque/api/jobs/failed"(controller: 'jesqueAdminJob', action: 'failed', method: "GET")
"/jesque/api/jobs/failed/$id"(controller: 'jesqueAdminJob', action: 'retry', method: "POST")
"/jesque/api/jobs/failed/$id"(controller: 'jesqueAdminJob', action: 'remove', method: "DELETE")
"/jesque/api/jobs/failed"(controller: 'jesqueAdminJob', action: 'clear', method: "DELETE")
"/jesque/api/jobs/triggers"(controller: 'jesqueAdminJob', action: 'triggers', method: "GET")
"/jesque/api/jobs/triggers/$name"(controller: 'jesqueAdminJob', action: 'deleteTrigger', method: "DELETE")
"/jesque/api/jobs/$job"(controller: 'jesqueAdminStatistics', action: 'list', method: "GET")
"/jesque/api/workers"(controller: 'jesqueAdminWorker', action: 'list', method: 'GET')
"/jesque/api/workers"(controller: 'jesqueAdminWorker', action: 'manual', method: 'POST')
"/jesque/api/workers/$name"(controller: 'jesqueAdminWorker', action: 'remove', method: 'DELETE')
"/jesque/api/workers/pause"(controller: 'jesqueAdminWorker', action: 'pause', method: 'GET')
"/jesque/api/workers/resume"(controller: 'jesqueAdminWorker', action: 'resume', method: 'GET')

You can freely change "/jesque/api/" to whatever you want but i highly recommend not to change anything that comes after that.

Job Statistics

jesque-admin comes with mechanics to gather statistics like start, end and runtimes of Jobs. All this is done by using a specific Worker Listener. All you have to do is enable the statistics collecting feature in you application.yml (or .groovy):

grails:
    jesque:
        statistics:
          enabled: true
          max: 100 // the maximum number of statistics PER JOB CLASS to store

you also have to set JesqueJobStatisticsWorkerListener as a custom listener:

grails:
    jesque:
        enabled: true
        custom:
          listener:
            clazz: grails.plugins.jesque.admin.JesqueJobStatisticsWorkerListener

After restarting your App you should find a list menu item under "jobs" in jesque-admin which lets you browse past jobs being processed.

Development

If you want to extend jesque-admin or help developing it further simply start by:

  1. Run gradle bootRun -Djesque.admin.devel=true (or grails run-app or run the main method in Application.groovy whatever you prefer)
  2. Run npm i in the root folder of this plugin
  3. Run npm run devel

Note: you need node.js version 6.9.0

In order to build the project run the following commands:

  1. npm run package
  2. ./gradlew publishToMavenLocal