public class NCEmbeddedProbe extends Object
The standard processing flow with the data probe running in a separate JVM looks like this:
App ⇒ JVM1(REST Server) ⇒ JVM2(Probe) ⇒ JVM1(REST Server) ⇒ App
There are at least 4 networks hops between client application request and response.
However, when using native Java Client or Java Test Client
in embedded probe mode
the processing flow is shortened:
JVM1(App) ⇒ JVM2(REST Server) ⇒ JVM1(Probe -> App)
In this case there are only 2 hops as both client application and the data probe (and the model) are hosted
in the same JVM.
Notes:
Constructor and Description |
---|
NCEmbeddedProbe() |
Modifier and Type | Method and Description |
---|---|
static void |
registerCallback(Consumer<NCEmbeddedResult> cb)
Registers the callback on query processing results.
|
static void |
start(Class<? extends NCModel>... mdlClasses)
Starts the embedded probe with default configuration and specified models to deploy.
|
static void |
start(String cfgFile)
Start the embedded probe with given configuration file.
|
static void |
start(String probeId,
String tok,
String upLink,
String dnLink,
Class<? extends NCModel>... mdlClasses)
Starts the embedded probe with default configuration and specified overrides.
|
static void |
stop()
Stops the embedded probe, if it was started before.
|
static void |
unregisterCallback(Consumer<NCEmbeddedResult> cb)
Unregisters previously registered callback.
|
public static void start(String cfgFile)
-config=cfgFile
command line argument.cfgFile
- Configuration file path. It should be either a full path or the file name
that can be found in the current working directory or on the classpath as a class loader
resource.NCException
- Thrown in case of any errors starting the data probe.@SafeVarargs public static void start(Class<? extends NCModel>... mdlClasses)
mdlClasses
- One or more data model classes to be deployed by the embedded probe.NCException
- Thrown in case of any errors starting the data probe.@SafeVarargs public static void start(String probeId, String tok, String upLink, String dnLink, Class<? extends NCModel>... mdlClasses)
probeId
- Probe ID.tok
- Probe token.upLink
- Probe up-link to the server.dnLink
- Probe down-link from the server.mdlClasses
- One or more data model classes to be deployed by the embedded probe.NCException
- Thrown in case of any errors starting the data probe.public static void stop()
NCException
- Thrown in case of any errors stopping the data probe.public static void registerCallback(Consumer<NCEmbeddedResult> cb)
cb
- Callback to register.NCException
- Thrown in case of any errors registering a callback.public static void unregisterCallback(Consumer<NCEmbeddedResult> cb)
cb
- Callback to unregister.NCException
- Thrown in case of any errors unregistering a callback.Copyright © 2020 NLPCraft. All rights reserved.