Skip to content

API and Job Queue

Kai Hsia edited this page Jan 14, 2017 · 17 revisions

API

Event Queue

Redis Based Solutions

One major advantage that going with a redis-backed queue, is the control over which deployment platform gets chosen. This route will allow us to deploy where-ever we want.

  • Bull Job Manager looks to be a solid choice for the queue. It's api looks pretty straight forward. Supports delayed jobs, retries, job delays, etc. Also has three options for visualizing the job queue here, here, and here.
  • Kue has the most github stars (5,164). There are pretty easy to follow examples of Kue in use.
  • Redis Simple Message Queue (RSMQ) is very light-weight, but lacks some interesting features that Bull and Kue have.
  • QRX is a RsJX patterned redis-backed queue. While RxJS observables would be a great pattern to learn, this looks to still be in active development, and not quite finished.
  • Many others...

AWS Simple Queue Service

Great features out of the box, but ties us to hosting on AWS and developing within/around the AWS ecosystem.

Events

  • userCreate
    • receives: {socketId: [string, required], userName: [string, required], password: [string, required]}
    • returns: {socketId: [string, required], status: [string, required, options: [success, error]], JWT: [string, optional]}
  • userChangePassword
    • receives: {socketId: [string, required], userId: [string, required], oldPassword: [string, required], newPassword: [string, required]}
    • returns: {socketId: [string, required], status: [string, required, options: [success, error]]}
  • userSignIn
    • receives: {socketId: [string, required], userName: [string, required], password: [string, required]}
    • returns: {socketId: [string, required], status: [string, required, options: [success, error]], JWT: [string, optional]}
  • userLogOut
    • receives: {socketId: [string, required], userId: [string, required], JWT: [string, required]}
    • returns: {socketId: [string, required], status: [string, required, options: [success, error]]}
  • walletGenerate
    • receives: {socketId: [string, required], userId: [string], currency: [string]}
    • returns: {userId: [string], currency: [string], walletId: [string]}
  • walletTransferOut
    • receives: {currency: [string, required, options: [BTC, LTC, ETH]], amount: [integer]}
    • returns: {status: [string, required, options: [complete, processing, error]], transactionId: [string, required]}
  • initBalance (to set a new user's balance for all currencies, available & actual, to 0)
    • receives: {userID: [string, required]}
  • checkBalance (to check a desired usernames balance of specified currency type)
    • receives: {userID: [string, required], currency: [string, required, options: [BTC, LTC, ETH]]}, balanceType: {string, required, options:['available', 'actual']}
  • updateBalance (to increment or decrement desired usernames balance of specified currency type)
    • receives: {userID: [string, required], update: [integer], currency: [string, required, options: [BTC, LTC, ETH]], balanceType: [string, required (unless isExternal === false)], isExternal: [boolean] }
  • returnBalance (response event to 'checkBalance' & 'updateBalance')
    • returns: {userID: [string, required], currency: [string, required, options: [BTC, LTC, ETH], balance: [integer], balanceType: [string, options:['available', 'actual']]}
  • transaction (returns/stores an openOrders and TransactionHistory list)
    • receives: {userID: [string, required], amount: [integer, required], price: [float, required], currency: [string, required]}
    • returns: [{price: [float, required], amount: [integer, required]}, required], [{price: [float, required], bought: [integer, required], from: [string, required], originalID: [string, required]}, required]

Clone this wiki locally