Packages

package event

Content Hierarchy
Ordering
  1. Alphabetic
Visibility
  1. Public
  2. Protected

Package Members

  1. package japi
  2. package jul
  3. package slf4j

Type Members

  1. class ActorClassificationUnsubscriber extends Actor with Stash

    INTERNAL API

    INTERNAL API

    Watches all actors which subscribe on the given event stream, and unsubscribes them from it when they are Terminated.

    Attributes
    protected[pekko]
  2. trait ActorClassifier extends AnyRef

    Can be mixed into an EventBus to specify that the Classifier type is ActorRef

  3. trait ActorEventBus extends EventBus

    Represents an EventBus where the Subscriber type is ActorRef

  4. class BusLogging extends LoggingAdapter

    pekko.event.LoggingAdapter that publishes pekko.event.Logging.LogEvent to event stream.

  5. class DeadLetterListener extends Actor
  6. class DefaultLoggingFilter extends LoggingFilterWithMarker

    Default LoggingFilter that uses the logLevel of the eventStream, which initial value is defined in configuration.

    Default LoggingFilter that uses the logLevel of the eventStream, which initial value is defined in configuration. The logLevel eventStream can be changed while the system is running.

  7. trait DiagnosticLoggingAdapter extends LoggingAdapter

    LoggingAdapter extension which adds MDC support.

    LoggingAdapter extension which adds MDC support. Only recommended to be used within Actors as it isn't thread safe.

  8. final class DiagnosticMarkerBusLoggingAdapter extends MarkerLoggingAdapter with DiagnosticLoggingAdapter
  9. class DummyClassForStringSources extends AnyRef

    This is a “marker” class which is inserted as originator class into pekko.event.Logging.LogEvent when the string representation was supplied directly.

  10. trait EventBus extends AnyRef

    Represents the base type for EventBuses Internally has an Event type, a Classifier type and a Subscriber type

    Represents the base type for EventBuses Internally has an Event type, a Classifier type and a Subscriber type

    For the Java API, see pekko.event.japi.*

  11. class EventStream extends LoggingBus with SubchannelClassification

    An Apache Pekko EventStream is a pub-sub stream of events both system and user generated, where subscribers are ActorRefs and the channels are Classes and Events are any java.lang.Object.

    An Apache Pekko EventStream is a pub-sub stream of events both system and user generated, where subscribers are ActorRefs and the channels are Classes and Events are any java.lang.Object. EventStreams employ SubchannelClassification, which means that if you listen to a Class, you'll receive any message that is of that type or a subtype.

    The debug flag in the constructor toggles if operations on this EventStream should also be published as Debug-Events

  12. class EventStreamUnsubscriber extends Actor

    INTERNAL API

    INTERNAL API

    Watches all actors which subscribe on the given eventStream, and unsubscribes them from it when they are Terminated.

    Assumptions note: We do not guarantee happens-before in the EventStream when 2 threads subscribe(a) / unsubscribe(a) on the same actor, thus the messages sent to this actor may appear to be reordered - this is fine, because the worst-case is starting to needlessly watch the actor which will not cause trouble for the stream. This is a trade-off between slowing down subscribe calls * because of the need of linearizing the history message sequence and the possibility of sometimes watching a few actors too much - we opt for the 2nd choice here.

    Attributes
    protected[pekko]
  13. class LogMarker extends AnyRef

    DO NOT INHERIT: Class is open only for use by pekko-slf4j

    DO NOT INHERIT: Class is open only for use by pekko-slf4j

    Annotations
    @DoNotInherit()
  14. trait LogSource[-T] extends AnyRef

    This trait defines the interface to be provided by a “log source formatting rule” as used by pekko.event.Logging’s apply/create method.

    This trait defines the interface to be provided by a “log source formatting rule” as used by pekko.event.Logging’s apply/create method.

    See the companion object for default implementations.

    Example:

    trait MyType { // as an example
      def name: String
    }
    
    implicit val myLogSourceType: LogSource[MyType] = new LogSource[MyType] {
      def genString(a: MyType) = a.name
    }
    
    class MyClass extends MyType {
      val log = Logging(eventStream, this) // will use "hallo" as logSource
      def name = "hallo"
    }

    The second variant is used for including the actor system’s address:

    trait MyType { // as an example
      def name: String
    }
    
    implicit val myLogSourceType: LogSource[MyType] = new LogSource[MyType] {
      def genString(a: MyType) = a.name
      def genString(a: MyType, s: ActorSystem) = a.name + "," + s
    }
    
    class MyClass extends MyType {
      val sys = ActorSystem("sys")
      val log = Logging(sys, this) // will use "hallo,pekko://sys" as logSource
      def name = "hallo"
    }

    The default implementation of the second variant will just call the first.

    Annotations
    @implicitNotFound()
  15. trait LoggerMessageQueueSemantics extends AnyRef
  16. trait LoggingAdapter extends AnyRef

    Logging wrapper to make nicer and optimize: provide template versions which evaluate .toString only if the log level is actually enabled.

    Logging wrapper to make nicer and optimize: provide template versions which evaluate .toString only if the log level is actually enabled. Typically used by obtaining an implementation from the Logging object:

    val log = Logging(<bus>, <source object>)
    ...
    log.info("hello world!")

    All log-level methods support simple interpolation templates with up to four arguments placed by using {} within the template (first string argument):

    log.error(exception, "Exception while processing {} in state {}", msg, state)

    More than four arguments can be defined by using an Array with the method with one argument parameter.

  17. trait LoggingBus extends ActorEventBus

    This trait brings log level handling to the EventStream: it reads the log levels for the initial logging (StandardOutLogger) and the loggers & level for after-init logging, possibly keeping the StandardOutLogger enabled if it is part of the configured loggers.

    This trait brings log level handling to the EventStream: it reads the log levels for the initial logging (StandardOutLogger) and the loggers & level for after-init logging, possibly keeping the StandardOutLogger enabled if it is part of the configured loggers. All configured loggers are treated as system services and managed by this trait, i.e. subscribed/unsubscribed in response to changes of LoggingBus.logLevel.

  18. trait LoggingFilter extends AnyRef

    Filter of log events that is used by the LoggingAdapter before publishing log events to the eventStream.

    Filter of log events that is used by the LoggingAdapter before publishing log events to the eventStream. It can perform fine grained filtering based on the log source.

    Note that the EventStream will only subscribe loggers to the events corresponding to the logLevel of the EventStream. Therefore it is good practice that the LoggingFilter implementation first filters using the logLevel of the EventStream before applying more fine grained filters.

  19. trait LoggingFilterWithMarker extends LoggingFilter

    In retrospect should have been abstract, but we cannot change that without breaking binary compatibility

    In retrospect should have been abstract, but we cannot change that without breaking binary compatibility

    Annotations
    @nowarn()
  20. class LoggingFilterWithMarkerWrapper extends LoggingFilterWithMarker
  21. class LoggingReceive extends Receive

    This decorator adds invocation logging to a Receive function.

  22. trait LookupClassification extends AnyRef

    Maps Subscribers to Classifiers using equality on Classifier to store a Set of Subscribers (hence the need for compareSubscribers) Maps Events to Classifiers through the classify-method (so it knows who to publish to)

    Maps Subscribers to Classifiers using equality on Classifier to store a Set of Subscribers (hence the need for compareSubscribers) Maps Events to Classifiers through the classify-method (so it knows who to publish to)

    The compareSubscribers need to provide a total ordering of the Subscribers

  23. trait ManagedActorClassification extends AnyRef

    Maps ActorRefs to ActorRefs to form an EventBus where ActorRefs can listen to other ActorRefs.

    Maps ActorRefs to ActorRefs to form an EventBus where ActorRefs can listen to other ActorRefs.

    All subscribers will be watched by an org.apache.pekko.event.ActorClassificationUnsubscriber and unsubscribed when they terminate. The unsubscriber actor will not be stopped automatically, and if you want to stop using the bus you should stop it yourself.

  24. class MarkerLoggingAdapter extends BusLogging

    LoggingAdapter extension which adds Marker support.

  25. trait PredicateClassifier extends AnyRef

    Can be mixed into an EventBus to specify that the Classifier type is a Function from Event to Boolean (predicate)

  26. trait ScanningClassification extends AnyRef

    Maps Classifiers to Subscribers and selects which Subscriber should receive which publication through scanning through all Subscribers through the matches(classifier, event) method

    Maps Classifiers to Subscribers and selects which Subscriber should receive which publication through scanning through all Subscribers through the matches(classifier, event) method

    Note: the compareClassifiers and compareSubscribers must together form an absolute ordering (think java.util.Comparator.compare)

  27. trait SubchannelClassification extends AnyRef

    Classification which respects relationships between channels: subscribing to one channel automatically and idempotently subscribes to all sub-channels.

Value Members

  1. object LogMarker
  2. object LogSource

    This object holds predefined formatting rules for log sources.

    This object holds predefined formatting rules for log sources.

    In case an pekko.actor.ActorSystem is provided, the following apply:

    • pekko.actor.Actor and pekko.actor.ActorRef will be represented by their absolute physical path
    • providing a String as source will append "(<system address>)" and use the result
    • providing a Class will extract its simple name, append "(<system address>)" and use the result
    • anything else gives compile error unless implicit pekko.event.LogSource is in scope for it

    In case a pekko.event.LoggingBus is provided, the following apply:

  3. object Logging

    Main entry point for Akka logging: log levels and message types (aka channels) defined for the main transport medium, the main event bus.

    Main entry point for Akka logging: log levels and message types (aka channels) defined for the main transport medium, the main event bus. The recommended use is to obtain an implementation of the Logging trait with suitable and efficient methods for generating log events:

    
    val log = Logging(<bus>, <source object>)
    ...
    log.info("hello world!")
    
    

    The source object is used in two fashions: its Class[_] will be part of all log events produced by this logger, plus a string representation is generated which may contain per-instance information, see apply or create below.

    Loggers are attached to the level-specific channels Error, Warning, Info and Debug as appropriate for the configured (or set) log level. If you want to implement your own, make sure to handle these four event types plus the InitializeLogger message which is sent before actually attaching it to the logging bus.

    Logging is configured by setting (some of) the following:

    
    pekko {
      loggers = ["org.apache.pekko.slf4j.Slf4jLogger"] # for example
      loglevel = "INFO"        # used when normal logging ("loggers") has been started
      stdout-loglevel = "WARN" # used during application start-up until normal logging is available
    }
    
    

  4. object LoggingFilterWithMarker
  5. object LoggingReceive
  6. object NoLogging extends LoggingAdapter

    NoLogging is a LoggingAdapter that does absolutely nothing – no logging at all.

  7. object NoMarkerLogging extends MarkerLoggingAdapter

    NoLogging is a MarkerLoggingAdapter that does absolutely nothing – no logging at all.

Ungrouped