Jobs alternatives and similar libraries
Based on the "Server" category.
Alternatively, view Jobs alternatives based on common mentions on social networks and blogs.
-
Perfect
Server-side Swift. The Perfect core toolset and framework for Swift Developers. (For mobile back-end development, website and API development, and moreβ¦) -
GCDWebServer
The #1 HTTP server for iOS, macOS & tvOS (also includes web based uploader & WebDAV server) -
CocoaHTTPServer
A small, lightweight, embeddable HTTP server for Mac OS X or iOS applications -
Swifton
A Ruby on Rails inspired Web Framework for Swift that runs on Linux and OS X -
Zewo
Lightweight library for web server applications in Swift on macOS and Linux powered by coroutines. -
smoke-framework
A light-weight server-side service framework written in the Swift programming language. -
Express
Swift Express is a simple, yet unopinionated web application server written in Swift -
Embassy
Super lightweight async HTTP server library in pure Swift runs in iOS / MacOS / Linux -
Edge
A Swift Multiplatform Single-threaded Non-blocking Web and Networking Framework -
Dynamo
High Performance (nearly)100% Swift Web server supporting dynamic content.
Appwrite - The Open Source Firebase alternative introduces iOS support
* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest.
Do you think we are missing an alternative of Jobs or a related project?
Popular Comparisons
README
Jobs
A minimalistic job system in Swift, for Swift
Table of Contents
Integration
Update your Package.swift
file.
.package(url: "https://github.com/BrettRToomey/Jobs.git", from: "1.1.1")
Getting started π
Creating a new Job
is as simple as:
Jobs.add(interval: .seconds(4)) {
print("π I'm printed every 4 seconds!")
}
Intervals β²
The Duration
enumeration currently supports .seconds
, hours
, .days
and .weeks
.
Jobs.add(interval: .days(5)) {
print("See you every 5 days.")
}
Syntax candy π
It's possible to create a Duration
from an Int
and a Double
.
10.seconds // `Duration.seconds(10)`
4.hours // `Duration.hours(4)`
2.days // `Duration.days(2)`
3.weeks // `Duration.weeks(3)`
Starting a job π¬
By default, Job
s are started automatically, but if you wish to start one yourself, even at a later point in time, just do the following:
let job = Jobs.add(interval: 2.seconds, autoStart: false) {
print("I wasn't started right away.")
}
//...
job.start()
Stopping a job β
Giving up has never been so easy!
job.stop()
One-off jobs
If you just want to asynchronously run a job, but not repeat it you can use the oneoff
functions.
Jobs.oneoff {
print("Sadly, I'm not a phoenix.")
}
How about waiting a little?
Jobs.oneoff(delay: 10.seconds) {
print("I was delayed by 10 seconds.")
}
Error handling β
Sometimes jobs can fail, that's okay, we have you covered.
Jobs.add(
interval: 10.seconds,
action: {
throw Error.someError
},
onError: { error in
print("caught an error: \(error)")
return RecoverStrategy.default
}
)
Retry on failure βοΈ
By default, jobs will be attempted again after a five second delay. If you wish to override this behavior you must first implement an onError
handler and return one of the following RecoveryStrategy
cases.
.none //do not retry
.default //retry after 5 seconds
.retry(after: Duration) //retry after specified duration
Here's a small sample:
enum Error: Swift.Error {
case recoverable
case abort
}
Jobs.add(
interval: 1.days,
action: {
//...
},
onError: { error in
switch error {
//we cannot recover from this
case .abort:
//do not retry
return .none
//we can recover from this
case .recoverable:
//... recovery code
//try again in 15 seconds
return .retry(after: 15.seconds)
}
}
)
*Note that all licence references and agreements mentioned in the Jobs README section above
are relevant to that project's source code only.