| register_async | R Documentation |
plumber supports async request handling in two ways. Either manual by
returning a promise from the handler, or automatic through the @async tag /
async argument in the handler functions. The
default evaluator is controlled by the plumber2.async option or the
PLUMBER2_ASYNC environment variable.
register_async(name, fun, dependency = NULL)
show_registered_async()
get_async(name = NULL, ...)
name |
The name of the evaluator |
fun |
A function that, upon calling it returns an evaluator taking an
|
dependency |
Package dependencies for the evaluator. |
... |
Arguments passed on to the async function creator |
# Register an async evaluator based on future (the provided mirai backend is
# superior in every way so this is for illustrative purpose)
future_async <- function(...) {
function(expr, envir) {
promises::future_promise(
expr = expr,
envir = envir,
substitute = FALSE,
...
)
}
}
register_async("future", future_async, c("promises", "future"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.