2011-12-19 11:07:59 +01:00
|
|
|
/**
|
2017-01-04 17:37:10 +01:00
|
|
|
* Copyright (C) 2009-2017 Lightbend Inc. <http://www.lightbend.com>
|
2011-12-19 11:07:59 +01:00
|
|
|
*/
|
2017-03-16 09:30:00 +01:00
|
|
|
package jdocs.event;
|
2011-12-13 12:33:29 +01:00
|
|
|
|
|
|
|
|
//#imports
|
2015-07-01 18:05:17 +02:00
|
|
|
import akka.actor.*;
|
2011-12-13 12:33:29 +01:00
|
|
|
import akka.event.Logging;
|
|
|
|
|
import akka.event.LoggingAdapter;
|
|
|
|
|
|
|
|
|
|
//#imports
|
|
|
|
|
|
|
|
|
|
//#imports-listener
|
|
|
|
|
import akka.event.Logging.InitializeLogger;
|
|
|
|
|
import akka.event.Logging.Error;
|
|
|
|
|
import akka.event.Logging.Warning;
|
|
|
|
|
import akka.event.Logging.Info;
|
|
|
|
|
import akka.event.Logging.Debug;
|
|
|
|
|
|
|
|
|
|
//#imports-listener
|
|
|
|
|
|
2017-03-16 09:30:00 +01:00
|
|
|
import jdocs.AbstractJavaTest;
|
2011-12-13 12:33:29 +01:00
|
|
|
import org.junit.Test;
|
2013-05-02 17:12:36 +02:00
|
|
|
import akka.testkit.JavaTestKit;
|
improve AbstractActor, #21717
* Receive class that wraps PartialFunction, to avoid
scary scala types
* move AbstractActorContext to AbstractActor.ActorContext
* converting docs, many, many UntypedActor
* removing UntypedActor docs
* add unit test for ReceiveBuilder
* MiMa filters
* consistent use of getContext(), self(), sender()
* rename cross references
* migration guide
* skip samples for now
* improve match type safetyi, add matchUnchecked
* the `? extends P` caused code like this to compile:
`match(String.class, (Integer i) -> {})`
* added matchUnchecked, since it can still be useful (um, convenient)
to be able to do:
`matchUnchecked(List.class, (List<String> list) -> {})`
* eleminate some scala.Option
* preRestart
* findChild
* ActorIdentity.getActorRef
2016-12-13 10:59:29 +01:00
|
|
|
import java.util.Optional;
|
2011-12-13 12:33:29 +01:00
|
|
|
|
2013-10-18 01:10:10 -03:00
|
|
|
//#imports-mdc
|
|
|
|
|
import akka.event.DiagnosticLoggingAdapter;
|
|
|
|
|
import java.util.HashMap;
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
//#imports-mdc
|
|
|
|
|
|
2011-12-30 00:00:25 +01:00
|
|
|
//#imports-deadletter
|
2011-12-13 12:33:29 +01:00
|
|
|
import akka.actor.ActorRef;
|
2011-12-13 15:37:16 +01:00
|
|
|
import akka.actor.ActorSystem;
|
2011-12-30 00:00:25 +01:00
|
|
|
//#imports-deadletter
|
2011-12-13 12:33:29 +01:00
|
|
|
|
2016-02-11 16:39:25 +01:00
|
|
|
public class LoggingDocTest extends AbstractJavaTest {
|
2015-07-01 18:05:17 +02:00
|
|
|
|
2011-12-13 12:33:29 +01:00
|
|
|
@Test
|
|
|
|
|
public void useLoggingActor() {
|
|
|
|
|
ActorSystem system = ActorSystem.create("MySystem");
|
2013-04-14 22:56:41 +02:00
|
|
|
ActorRef myActor = system.actorOf(Props.create(MyActor.class, this));
|
2013-06-05 16:59:25 +02:00
|
|
|
myActor.tell("test", ActorRef.noSender());
|
2013-05-02 17:12:36 +02:00
|
|
|
JavaTestKit.shutdownActorSystem(system);
|
2011-12-13 12:33:29 +01:00
|
|
|
}
|
|
|
|
|
|
2013-10-18 01:10:10 -03:00
|
|
|
@Test
|
|
|
|
|
public void useLoggingActorWithMDC() {
|
|
|
|
|
ActorSystem system = ActorSystem.create("MyDiagnosticSystem");
|
|
|
|
|
ActorRef mdcActor = system.actorOf(Props.create(MdcActor.class, this));
|
|
|
|
|
mdcActor.tell("some request", ActorRef.noSender());
|
|
|
|
|
JavaTestKit.shutdownActorSystem(system);
|
|
|
|
|
}
|
|
|
|
|
|
2011-12-30 00:00:25 +01:00
|
|
|
@Test
|
|
|
|
|
public void subscribeToDeadLetters() {
|
|
|
|
|
//#deadletters
|
|
|
|
|
final ActorSystem system = ActorSystem.create("DeadLetters");
|
2013-04-14 22:56:41 +02:00
|
|
|
final ActorRef actor = system.actorOf(Props.create(DeadLetterActor.class));
|
2011-12-30 00:00:25 +01:00
|
|
|
system.eventStream().subscribe(actor, DeadLetter.class);
|
|
|
|
|
//#deadletters
|
2013-05-02 17:12:36 +02:00
|
|
|
JavaTestKit.shutdownActorSystem(system);
|
2011-12-30 00:00:25 +01:00
|
|
|
}
|
2014-11-27 13:12:48 +01:00
|
|
|
|
2015-07-01 18:05:17 +02:00
|
|
|
//#superclass-subscription-eventstream
|
|
|
|
|
interface AllKindsOfMusic { }
|
|
|
|
|
|
|
|
|
|
class Jazz implements AllKindsOfMusic {
|
|
|
|
|
final public String artist;
|
|
|
|
|
public Jazz(String artist) {
|
|
|
|
|
this.artist = artist;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
class Electronic implements AllKindsOfMusic {
|
|
|
|
|
final public String artist;
|
|
|
|
|
public Electronic(String artist) {
|
|
|
|
|
this.artist = artist;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
improve AbstractActor, #21717
* Receive class that wraps PartialFunction, to avoid
scary scala types
* move AbstractActorContext to AbstractActor.ActorContext
* converting docs, many, many UntypedActor
* removing UntypedActor docs
* add unit test for ReceiveBuilder
* MiMa filters
* consistent use of getContext(), self(), sender()
* rename cross references
* migration guide
* skip samples for now
* improve match type safetyi, add matchUnchecked
* the `? extends P` caused code like this to compile:
`match(String.class, (Integer i) -> {})`
* added matchUnchecked, since it can still be useful (um, convenient)
to be able to do:
`matchUnchecked(List.class, (List<String> list) -> {})`
* eleminate some scala.Option
* preRestart
* findChild
* ActorIdentity.getActorRef
2016-12-13 10:59:29 +01:00
|
|
|
static class Listener extends AbstractActor {
|
2015-07-01 18:05:17 +02:00
|
|
|
@Override
|
improve AbstractActor, #21717
* Receive class that wraps PartialFunction, to avoid
scary scala types
* move AbstractActorContext to AbstractActor.ActorContext
* converting docs, many, many UntypedActor
* removing UntypedActor docs
* add unit test for ReceiveBuilder
* MiMa filters
* consistent use of getContext(), self(), sender()
* rename cross references
* migration guide
* skip samples for now
* improve match type safetyi, add matchUnchecked
* the `? extends P` caused code like this to compile:
`match(String.class, (Integer i) -> {})`
* added matchUnchecked, since it can still be useful (um, convenient)
to be able to do:
`matchUnchecked(List.class, (List<String> list) -> {})`
* eleminate some scala.Option
* preRestart
* findChild
* ActorIdentity.getActorRef
2016-12-13 10:59:29 +01:00
|
|
|
public Receive createReceive() {
|
|
|
|
|
return receiveBuilder()
|
|
|
|
|
.match(Jazz.class, msg ->
|
2017-03-16 09:30:00 +01:00
|
|
|
System.out.printf("%s is listening to: %s%n", getSelf().path().name(), msg)
|
improve AbstractActor, #21717
* Receive class that wraps PartialFunction, to avoid
scary scala types
* move AbstractActorContext to AbstractActor.ActorContext
* converting docs, many, many UntypedActor
* removing UntypedActor docs
* add unit test for ReceiveBuilder
* MiMa filters
* consistent use of getContext(), self(), sender()
* rename cross references
* migration guide
* skip samples for now
* improve match type safetyi, add matchUnchecked
* the `? extends P` caused code like this to compile:
`match(String.class, (Integer i) -> {})`
* added matchUnchecked, since it can still be useful (um, convenient)
to be able to do:
`matchUnchecked(List.class, (List<String> list) -> {})`
* eleminate some scala.Option
* preRestart
* findChild
* ActorIdentity.getActorRef
2016-12-13 10:59:29 +01:00
|
|
|
)
|
|
|
|
|
.match(Electronic.class, msg ->
|
2017-03-16 09:30:00 +01:00
|
|
|
System.out.printf("%s is listening to: %s%n", getSelf().path().name(), msg)
|
improve AbstractActor, #21717
* Receive class that wraps PartialFunction, to avoid
scary scala types
* move AbstractActorContext to AbstractActor.ActorContext
* converting docs, many, many UntypedActor
* removing UntypedActor docs
* add unit test for ReceiveBuilder
* MiMa filters
* consistent use of getContext(), self(), sender()
* rename cross references
* migration guide
* skip samples for now
* improve match type safetyi, add matchUnchecked
* the `? extends P` caused code like this to compile:
`match(String.class, (Integer i) -> {})`
* added matchUnchecked, since it can still be useful (um, convenient)
to be able to do:
`matchUnchecked(List.class, (List<String> list) -> {})`
* eleminate some scala.Option
* preRestart
* findChild
* ActorIdentity.getActorRef
2016-12-13 10:59:29 +01:00
|
|
|
)
|
|
|
|
|
.build();
|
2015-07-01 18:05:17 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//#superclass-subscription-eventstream
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
public void subscribeBySubclassification() {
|
|
|
|
|
final ActorSystem system = ActorSystem.create("DeadLetters");
|
|
|
|
|
//#superclass-subscription-eventstream
|
|
|
|
|
final ActorRef actor = system.actorOf(Props.create(DeadLetterActor.class));
|
|
|
|
|
system.eventStream().subscribe(actor, DeadLetter.class);
|
|
|
|
|
|
|
|
|
|
final ActorRef jazzListener = system.actorOf(Props.create(Listener.class));
|
|
|
|
|
final ActorRef musicListener = system.actorOf(Props.create(Listener.class));
|
|
|
|
|
system.eventStream().subscribe(jazzListener, Jazz.class);
|
|
|
|
|
system.eventStream().subscribe(musicListener, AllKindsOfMusic.class);
|
|
|
|
|
|
|
|
|
|
// only musicListener gets this message, since it listens to *all* kinds of music:
|
|
|
|
|
system.eventStream().publish(new Electronic("Parov Stelar"));
|
|
|
|
|
|
|
|
|
|
// jazzListener and musicListener will be notified about Jazz:
|
|
|
|
|
system.eventStream().publish(new Jazz("Sonny Rollins"));
|
|
|
|
|
|
|
|
|
|
//#superclass-subscription-eventstream
|
|
|
|
|
JavaTestKit.shutdownActorSystem(system);
|
|
|
|
|
}
|
|
|
|
|
|
2014-11-27 13:12:48 +01:00
|
|
|
@Test
|
|
|
|
|
public void subscribeToSuppressedDeadLetters() {
|
|
|
|
|
final ActorSystem system = ActorSystem.create("SuppressedDeadLetters");
|
|
|
|
|
final ActorRef actor = system.actorOf(Props.create(DeadLetterActor.class));
|
2015-07-01 18:05:17 +02:00
|
|
|
|
2014-11-27 13:12:48 +01:00
|
|
|
//#suppressed-deadletters
|
|
|
|
|
system.eventStream().subscribe(actor, SuppressedDeadLetter.class);
|
|
|
|
|
//#suppressed-deadletters
|
|
|
|
|
|
|
|
|
|
JavaTestKit.shutdownActorSystem(system);
|
|
|
|
|
}
|
|
|
|
|
@Test
|
|
|
|
|
public void subscribeToAllDeadLetters() {
|
|
|
|
|
final ActorSystem system = ActorSystem.create("AllDeadLetters");
|
|
|
|
|
final ActorRef actor = system.actorOf(Props.create(DeadLetterActor.class));
|
|
|
|
|
|
|
|
|
|
//#all-deadletters
|
|
|
|
|
system.eventStream().subscribe(actor, AllDeadLetters.class);
|
|
|
|
|
//#all-deadletters
|
|
|
|
|
|
|
|
|
|
JavaTestKit.shutdownActorSystem(system);
|
|
|
|
|
}
|
|
|
|
|
|
2012-02-22 11:00:00 +01:00
|
|
|
@Test
|
|
|
|
|
public void demonstrateMultipleArgs() {
|
|
|
|
|
final ActorSystem system = ActorSystem.create("multiArg");
|
|
|
|
|
//#array
|
|
|
|
|
final Object[] args = new Object[] { "The", "brown", "fox", "jumps", 42 };
|
|
|
|
|
system.log().debug("five parameters: {}, {}, {}, {}, {}", args);
|
|
|
|
|
//#array
|
2013-05-02 17:12:36 +02:00
|
|
|
JavaTestKit.shutdownActorSystem(system);
|
2012-02-22 11:00:00 +01:00
|
|
|
}
|
2011-12-30 00:00:25 +01:00
|
|
|
|
2011-12-13 12:33:29 +01:00
|
|
|
//#my-actor
|
improve AbstractActor, #21717
* Receive class that wraps PartialFunction, to avoid
scary scala types
* move AbstractActorContext to AbstractActor.ActorContext
* converting docs, many, many UntypedActor
* removing UntypedActor docs
* add unit test for ReceiveBuilder
* MiMa filters
* consistent use of getContext(), self(), sender()
* rename cross references
* migration guide
* skip samples for now
* improve match type safetyi, add matchUnchecked
* the `? extends P` caused code like this to compile:
`match(String.class, (Integer i) -> {})`
* added matchUnchecked, since it can still be useful (um, convenient)
to be able to do:
`matchUnchecked(List.class, (List<String> list) -> {})`
* eleminate some scala.Option
* preRestart
* findChild
* ActorIdentity.getActorRef
2016-12-13 10:59:29 +01:00
|
|
|
class MyActor extends AbstractActor {
|
2017-03-16 09:30:00 +01:00
|
|
|
LoggingAdapter log = Logging.getLogger(getContext().getSystem(), this);
|
2011-12-13 12:33:29 +01:00
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void preStart() {
|
|
|
|
|
log.debug("Starting");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
improve AbstractActor, #21717
* Receive class that wraps PartialFunction, to avoid
scary scala types
* move AbstractActorContext to AbstractActor.ActorContext
* converting docs, many, many UntypedActor
* removing UntypedActor docs
* add unit test for ReceiveBuilder
* MiMa filters
* consistent use of getContext(), self(), sender()
* rename cross references
* migration guide
* skip samples for now
* improve match type safetyi, add matchUnchecked
* the `? extends P` caused code like this to compile:
`match(String.class, (Integer i) -> {})`
* added matchUnchecked, since it can still be useful (um, convenient)
to be able to do:
`matchUnchecked(List.class, (List<String> list) -> {})`
* eleminate some scala.Option
* preRestart
* findChild
* ActorIdentity.getActorRef
2016-12-13 10:59:29 +01:00
|
|
|
public void preRestart(Throwable reason, Optional<Object> message) {
|
2012-09-26 10:56:25 +02:00
|
|
|
log.error(reason, "Restarting due to [{}] when processing [{}]",
|
improve AbstractActor, #21717
* Receive class that wraps PartialFunction, to avoid
scary scala types
* move AbstractActorContext to AbstractActor.ActorContext
* converting docs, many, many UntypedActor
* removing UntypedActor docs
* add unit test for ReceiveBuilder
* MiMa filters
* consistent use of getContext(), self(), sender()
* rename cross references
* migration guide
* skip samples for now
* improve match type safetyi, add matchUnchecked
* the `? extends P` caused code like this to compile:
`match(String.class, (Integer i) -> {})`
* added matchUnchecked, since it can still be useful (um, convenient)
to be able to do:
`matchUnchecked(List.class, (List<String> list) -> {})`
* eleminate some scala.Option
* preRestart
* findChild
* ActorIdentity.getActorRef
2016-12-13 10:59:29 +01:00
|
|
|
reason.getMessage(), message.isPresent() ? message.get() : "");
|
2011-12-13 12:33:29 +01:00
|
|
|
}
|
|
|
|
|
|
improve AbstractActor, #21717
* Receive class that wraps PartialFunction, to avoid
scary scala types
* move AbstractActorContext to AbstractActor.ActorContext
* converting docs, many, many UntypedActor
* removing UntypedActor docs
* add unit test for ReceiveBuilder
* MiMa filters
* consistent use of getContext(), self(), sender()
* rename cross references
* migration guide
* skip samples for now
* improve match type safetyi, add matchUnchecked
* the `? extends P` caused code like this to compile:
`match(String.class, (Integer i) -> {})`
* added matchUnchecked, since it can still be useful (um, convenient)
to be able to do:
`matchUnchecked(List.class, (List<String> list) -> {})`
* eleminate some scala.Option
* preRestart
* findChild
* ActorIdentity.getActorRef
2016-12-13 10:59:29 +01:00
|
|
|
@Override
|
|
|
|
|
public Receive createReceive() {
|
|
|
|
|
return receiveBuilder()
|
|
|
|
|
.matchEquals("test", msg ->
|
|
|
|
|
log.info("Received test")
|
|
|
|
|
)
|
|
|
|
|
.matchAny(msg ->
|
|
|
|
|
log.warning("Received unknown message: {}", msg)
|
|
|
|
|
)
|
|
|
|
|
.build();
|
2011-12-13 12:33:29 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//#my-actor
|
|
|
|
|
|
2013-10-18 01:10:10 -03:00
|
|
|
//#mdc-actor
|
improve AbstractActor, #21717
* Receive class that wraps PartialFunction, to avoid
scary scala types
* move AbstractActorContext to AbstractActor.ActorContext
* converting docs, many, many UntypedActor
* removing UntypedActor docs
* add unit test for ReceiveBuilder
* MiMa filters
* consistent use of getContext(), self(), sender()
* rename cross references
* migration guide
* skip samples for now
* improve match type safetyi, add matchUnchecked
* the `? extends P` caused code like this to compile:
`match(String.class, (Integer i) -> {})`
* added matchUnchecked, since it can still be useful (um, convenient)
to be able to do:
`matchUnchecked(List.class, (List<String> list) -> {})`
* eleminate some scala.Option
* preRestart
* findChild
* ActorIdentity.getActorRef
2016-12-13 10:59:29 +01:00
|
|
|
class MdcActor extends AbstractActor {
|
2013-10-18 01:10:10 -03:00
|
|
|
|
|
|
|
|
final DiagnosticLoggingAdapter log = Logging.getLogger(this);
|
|
|
|
|
|
improve AbstractActor, #21717
* Receive class that wraps PartialFunction, to avoid
scary scala types
* move AbstractActorContext to AbstractActor.ActorContext
* converting docs, many, many UntypedActor
* removing UntypedActor docs
* add unit test for ReceiveBuilder
* MiMa filters
* consistent use of getContext(), self(), sender()
* rename cross references
* migration guide
* skip samples for now
* improve match type safetyi, add matchUnchecked
* the `? extends P` caused code like this to compile:
`match(String.class, (Integer i) -> {})`
* added matchUnchecked, since it can still be useful (um, convenient)
to be able to do:
`matchUnchecked(List.class, (List<String> list) -> {})`
* eleminate some scala.Option
* preRestart
* findChild
* ActorIdentity.getActorRef
2016-12-13 10:59:29 +01:00
|
|
|
@Override
|
|
|
|
|
public Receive createReceive() {
|
|
|
|
|
return receiveBuilder()
|
|
|
|
|
.matchAny(msg -> {
|
|
|
|
|
Map<String, Object> mdc;
|
|
|
|
|
mdc = new HashMap<String, Object>();
|
|
|
|
|
mdc.put("requestId", 1234);
|
|
|
|
|
mdc.put("visitorId", 5678);
|
|
|
|
|
log.setMDC(mdc);
|
|
|
|
|
|
|
|
|
|
log.info("Starting new request");
|
|
|
|
|
|
|
|
|
|
log.clearMDC();
|
|
|
|
|
})
|
|
|
|
|
.build();
|
2013-10-18 01:10:10 -03:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//#mdc-actor
|
|
|
|
|
|
2011-12-13 12:33:29 +01:00
|
|
|
//#my-event-listener
|
improve AbstractActor, #21717
* Receive class that wraps PartialFunction, to avoid
scary scala types
* move AbstractActorContext to AbstractActor.ActorContext
* converting docs, many, many UntypedActor
* removing UntypedActor docs
* add unit test for ReceiveBuilder
* MiMa filters
* consistent use of getContext(), self(), sender()
* rename cross references
* migration guide
* skip samples for now
* improve match type safetyi, add matchUnchecked
* the `? extends P` caused code like this to compile:
`match(String.class, (Integer i) -> {})`
* added matchUnchecked, since it can still be useful (um, convenient)
to be able to do:
`matchUnchecked(List.class, (List<String> list) -> {})`
* eleminate some scala.Option
* preRestart
* findChild
* ActorIdentity.getActorRef
2016-12-13 10:59:29 +01:00
|
|
|
class MyEventListener extends AbstractActor {
|
|
|
|
|
@Override
|
|
|
|
|
public Receive createReceive() {
|
|
|
|
|
return receiveBuilder()
|
|
|
|
|
.match(InitializeLogger.class, msg -> {
|
2017-03-16 09:30:00 +01:00
|
|
|
getSender().tell(Logging.loggerInitialized(), getSelf());
|
improve AbstractActor, #21717
* Receive class that wraps PartialFunction, to avoid
scary scala types
* move AbstractActorContext to AbstractActor.ActorContext
* converting docs, many, many UntypedActor
* removing UntypedActor docs
* add unit test for ReceiveBuilder
* MiMa filters
* consistent use of getContext(), self(), sender()
* rename cross references
* migration guide
* skip samples for now
* improve match type safetyi, add matchUnchecked
* the `? extends P` caused code like this to compile:
`match(String.class, (Integer i) -> {})`
* added matchUnchecked, since it can still be useful (um, convenient)
to be able to do:
`matchUnchecked(List.class, (List<String> list) -> {})`
* eleminate some scala.Option
* preRestart
* findChild
* ActorIdentity.getActorRef
2016-12-13 10:59:29 +01:00
|
|
|
})
|
|
|
|
|
.match(Error.class, msg -> {
|
|
|
|
|
// ...
|
|
|
|
|
})
|
|
|
|
|
.match(Warning.class, msg -> {
|
|
|
|
|
// ...
|
|
|
|
|
})
|
|
|
|
|
.match(Info.class, msg -> {
|
|
|
|
|
// ...
|
|
|
|
|
})
|
|
|
|
|
.match(Debug.class, msg -> {
|
|
|
|
|
// ...
|
|
|
|
|
})
|
|
|
|
|
.build();
|
2011-12-13 12:33:29 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//#my-event-listener
|
|
|
|
|
|
2012-09-26 10:56:25 +02:00
|
|
|
static
|
2011-12-30 00:00:25 +01:00
|
|
|
//#deadletter-actor
|
improve AbstractActor, #21717
* Receive class that wraps PartialFunction, to avoid
scary scala types
* move AbstractActorContext to AbstractActor.ActorContext
* converting docs, many, many UntypedActor
* removing UntypedActor docs
* add unit test for ReceiveBuilder
* MiMa filters
* consistent use of getContext(), self(), sender()
* rename cross references
* migration guide
* skip samples for now
* improve match type safetyi, add matchUnchecked
* the `? extends P` caused code like this to compile:
`match(String.class, (Integer i) -> {})`
* added matchUnchecked, since it can still be useful (um, convenient)
to be able to do:
`matchUnchecked(List.class, (List<String> list) -> {})`
* eleminate some scala.Option
* preRestart
* findChild
* ActorIdentity.getActorRef
2016-12-13 10:59:29 +01:00
|
|
|
public class DeadLetterActor extends AbstractActor {
|
|
|
|
|
@Override
|
|
|
|
|
public Receive createReceive() {
|
|
|
|
|
return receiveBuilder()
|
|
|
|
|
.match(DeadLetter.class, msg -> {
|
|
|
|
|
System.out.println(msg);
|
|
|
|
|
})
|
|
|
|
|
.build();
|
2011-12-30 00:00:25 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//#deadletter-actor
|
2011-12-13 12:33:29 +01:00
|
|
|
}
|