slacker.server

slacker-function-not-found

slacker-ring-app

(slacker-ring-app fn-coll & {:keys [interceptors], :or {interceptors interceptor/default-interceptors}})

Wrap slacker as a ring async app that can be deployed to any ring adaptors. You can also configure interceptors just like start-slacker-server

start-slacker-server

(start-slacker-server fn-coll port & {:keys [http interceptors ssl-context threads queue-size executor executors], :or {interceptors interceptor/default-interceptors, threads 10, queue-size 3000, executor nil, executors {}}, :as options})

Start a slacker server to expose all public functions under a namespace, or a map or functions. If you have multiple namespace or map to expose, put fn-coll as a vector.

fn-coll examples:

  • (the-ns 'slacker.example.api): expose all public functions under slacker.example.api, except those marked with ^:no-slacker
  • {"slacker.example.api2" {"echo2 " (fn [a] a) ...}} expose all functions in this map
  • [(the-ns 'slacker.example.api) {...}] a vector of normal function collection

Options:

  • interceptors add server interceptors
  • Http Http port for slacker http transport
  • ssl-context the SSLContext object for enabling tls support
  • executor custom java.util.concurrent.ExecutorService for tasks execution, note this executor will be shutdown when you stop the slacker server
  • threads size of thread pool if no executor provided
  • queue-size size of thread pool task queue if no executor provided
  • executors a map of dedicated executors, key by namespace. You can configure dedicated thread pool for certain namespace.

stop-slacker-server

(stop-slacker-server server)