public class Matcher
extends java.lang.Object
StateMatcher
to
match against the state generated by subscribing a source of that state
param: currentStateSource source of the state which needs to be matched against the current state specified in state matcher param: stateMatcher the matcher definition to execute
Constructor and Description |
---|
Matcher(akka.actor.typed.ActorRef<ComponentCommonMessage.ComponentStateSubscription> currentStateSource,
StateMatcher stateMatcher,
scala.concurrent.ExecutionContext ec,
akka.stream.Materializer mat) |
Modifier and Type | Method and Description |
---|---|
java.util.concurrent.CompletableFuture<MatcherResponse> |
jStart()
Start the matching process from Java application
|
scala.concurrent.Future<MatcherResponse> |
start()
Start the matching process
|
void |
stop()
Abort the stream of subscribed state in case matching is no longer required.
|
public Matcher(akka.actor.typed.ActorRef<ComponentCommonMessage.ComponentStateSubscription> currentStateSource, StateMatcher stateMatcher, scala.concurrent.ExecutionContext ec, akka.stream.Materializer mat)
public java.util.concurrent.CompletableFuture<MatcherResponse> jStart()
public scala.concurrent.Future<MatcherResponse> start()
public void stop()
val matcherResponseF: Future[MatcherResponse] = matcher.start
val eventualCommandResponse: Future[CommandResponse] = async {
val initialResponse = await(assemblyComponent.oneway(setupWithMatcher))
initialResponse match {
case _: Accepted ⇒
val matcherResponse = await(matcherResponseF)
matcherResponse match {
case MatchCompleted ⇒ Completed(setupWithMatcher.runId)
case MatchFailed(ex) ⇒ Error(setupWithMatcher.runId, ex.getMessage)
}
case invalid: Invalid ⇒
matcher.stop()
invalid
case x ⇒ x
}