Lay the infrastructure for a microservice. That includes unit test, dependency packages, configuration file, entrypoints and utility endpoint.
path to a folder
use_microservice(path = ".") is called
Then the function creates the following files:
tests/testthat/test-endpoint-plumber-utility.R inst/configurations/plumber.yml inst/endpoints/plumber-utility.R inst/entrypoints/plumber-background.R inst/entrypoints/plumber-foreground.R
And updates the following files:
And adds the following packages to the DESCRIPTION file:
A Single user/machine applications.
Scheduled tasks. For example, you could use AirFlow with HTTP Operators to automate processes.
Comes with familiar way to document the microservice endpoint.
Maturing package that comes with documentation, examples and support.
Runs on a single thread. That means that parallel algorithms such as random forest, can only be run on one core.
Serves only one caller at a time.
Can’t make inward calls for other services, That means plumber can’t
For example, if a microservice has three endpoints,
orchestrator, where the
orchestrator reads a
data table, transforms it, and writes it back, then the
orchestrator can’t make inwards calls via HTTP to
plumber is single-threaded by nature, it is possible
to perform parallel execution using the
promises package. See links
Deploy the Microservice infrastructure
microservices::use_microservice(path = ".") remotes::install_deps() devtools::document()
Spin-up the microservice by running
Run the microservice unit-test by pressing Ctrl+Shift+T on Windows
Congratulations! You have added a microservice to your application and tested that it works.
No return value, called for side effects.
Other plumber microservice:
1 2 3 4 5 6 7
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.