Having trouble setting up withSupervisionStrategy for the materializer.
I get a compile time error of
Error:(30, 23) java: no suitable method found for
withSupervisionStrategy(akka.japi.function.Function<java.lang.Throwable,akka.actor.SupervisorStrategy.Directive>)
method
akka.stream.ActorMaterializerSettings.withSupervisionStrategy(scala.Function1<java.lang.Throwable,akka.stream.Supervision.Directive>)
is not applicable
(argument mismatch;
akka.japi.function.Function<java.lang.Throwable,akka.actor.SupervisorStrategy.Directive>
cannot be converted to
scala.Function1<java.lang.Throwable,akka.stream.Supervision.Directive>)
method
akka.stream.ActorMaterializerSettings.withSupervisionStrategy(akka.japi.function.Function<java.lang.Throwable,akka.stream.Supervision.Directive>)
is not applicable
(argument mismatch;
akka.japi.function.Function<java.lang.Throwable,akka.actor.SupervisorStrategy.Directive>
cannot be converted to
akka.japi.function.Function<java.lang.Throwable,akka.stream.Supervision.Directive>)
It for some reason is confusing the method that would be used for scala
(expecting a function1).
How do I get this to compile using java?
import akka.NotUsed;import akka.actor.ActorSystem;import
akka.actor.SupervisorStrategy;import akka.japi.function.Function;import
akka.stream.ActorAttributes;import akka.stream.ActorMaterializer;import
akka.stream.IOResult;import akka.stream.Supervision;import
akka.stream.javadsl.*;import akka.util.ByteString;import scala.Function1;
import java.io.File;import java.util.concurrent.CompletionStage;
/**
* Created by Murtuza on 10/19/2016.
*/public class EventFilter {
public static void main(String[] args) {
State filteredState = new State("ok");
ActorSystem system = ActorSystem.create("system");
ActorMaterializer mat = ActorMaterializer.create(system);
Function<Throwable,SupervisorStrategy.Directive> decider = thr
->SupervisorStrategy.resume();
mat.settings().withSupervisionStrategy(decider);
}
Below supervisionStrategy expects a Function1 unlike for the mat which
expects a japi function
Flow<String, Event, NotUsed> parse = Flow.of(String.class)
.map(x -> {
//System.out.println(LogStreamProcessor.parseLineEx(x).get());
return LogStreamProcessor.parseLineEx(x).get();
}).withAttributes(ActorAttributes.supervisionStrategy(...));
So I am kinda confused on passing the strategy.
Any help will be greatly appreciated.
-chhil
--
>>>>>>>>>> Read the docs: http://akka.io/docs/
>>>>>>>>>> Check the FAQ:
>>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user
---
You received this message because you are subscribed to the Google Groups "Akka
User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.