Giter VIP home page Giter VIP logo

queues-database-hooks's Introduction

QueuesDatabaseHooks

This package adds database success and failure tracking for all dequeued jobs.

Installation

Use the SPM string to easily include the dependendency in your Package.swift file.

.package(url: "https://github.com/vapor-community/queues-database-hooks.git", from: ...)

After you have the package installed, getting started is easy:

app.migrations.add(QueueDatabaseEntryMigration())
app.queues.add(QueuesDatabaseNotificationHook.default(db: app.db))

And that's all! Your app will now start tracking job data in your specified database.

Configuring the error handler

By default, the package will attempt to transform Errors into Strings via the localizedDescription property. You can pass in a closure when initializing the QueuesDatabaseNotificationHook object to specify how to transform errors. You can also pass in a closure for transforming the notification data (if, for example, you only want to save the payload data for certain job names.)

let dbHook = QueuesDatabaseNotificationHook(db: db) { error -> (String) in
    // Do something here with `error` that returns a string
} payloadClosure: { data -> (NotificationJobData) in
    return data
}
app.queues.add(dbHook)

What can I do with this data?

Out of the box, there's nothing built in to analyze the data that is captured. You can think of this as a "bring your own frontend" project - now that you have the data from your queue jobs you can do whatever you like with it.

That being said, there are some community projects built on top of the data that surface insights and create dashboards:

  1. https://github.com/gotranseo/queues-dash

queues-database-hooks's People

Contributors

gwynne avatar jdmcd avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

queues-database-hooks's Issues

Issue with QueuesFluentDriver

An error of Could not send dispatched notification: server: column "payload" is of type jsonb but expression is of type bytea is printed when used with QueuesFluentDriver.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.