Skip to content

Latest commit

 

History

History
66 lines (42 loc) · 1.54 KB

README.md

File metadata and controls

66 lines (42 loc) · 1.54 KB

Getting Started with Faktory in JavaScript

Faktory is designed to be as easy as possible for developers to run and use.

Clone

First clone this repo to get the demo app:

git clone [email protected]:contribsys/faktory_example.js.git
cd faktory_example.js

Installation

You can use Homebrew to install Faktory on macOS.

brew tap contribsys/faktory
brew install faktory

Upgrade to the latest version in the future with brew upgrade faktory.

Running the Example

You'll need to open three Terminal windows/tabs.

  1. In tab 1, start Faktory and open the Web UI.
faktory
open http://localhost:7420
  1. In tab 2, install our JS dependencies and start a client process pushing a new job to Faktory every second.
npm install
node ./fclient.js
  1. In tab 3, start a worker process which fetches jobs from Faktory and executes them:
node ./fworker.js

Exploring

While all three tabs are busy, go back to http://localhost7420 and check out the Faktory Web UI. Poke around each tab, you might not see much initially.

If you stop the fworker.js process with Ctrl-C, you'll see jobs accumulate in the default queue in the Queues tab. If you go back to the Home tab and start the worker again, you'll see a spike of activity on the Dashboard graph as the worker processes all of the accumulated jobs almost immediately.

Dependencies

Faktory itself has no dependencies but this example assumes you have a modern Node runtime installed. Run one of:

brew install node
brew upgrade node