Sends a one-way asynchronous message.
Sends a one-way asynchronous message. E.g. fire-and-forget semantics.
If invoked from within an actor then the actor reference is implicitly passed on as the implicit 'sender' argument.
This actor 'sender' reference is then available in the receiving actor in the 'sender' member variable, if invoked from within an Actor. If not then no sender is available.
actor ! message
Sends a message asynchronously, returning a future which may eventually hold the reply.
Sends a message asynchronously, returning a future which may eventually hold the reply. Is pronounced: "ask"
Directly inject messages into actor receive behavior.
Directly inject messages into actor receive behavior. Any exceptions thrown will be available to you, while still being able to use become/unbecome and their message counterparts.
Akka Java API.
Akka Java API.
Sends a message asynchronously returns a future holding the eventual reply message.
NOTE: Use this method with care. In most cases it is better to use 'tell' together with the 'getContext().getSender()' to implement request/response message exchanges.
If you are sending messages using ask
then you have to use getContext().reply(..)
to send a reply message to the original sender. If not then the sender will block until the timeout expires.
Akka Java API.
Akka Java API.
ask(message: AnyRef, sender: ActorRef): Future[_] Uses the Actors default timeout (setTimeout())
Akka Java API.
Akka Java API.
ask(message: AnyRef, sender: ActorRef): Future[_] Uses the specified timeout (milliseconds)
Akka Java API.
Akka Java API.
ask(message: AnyRef, sender: ActorRef): Future[_] Uses the Actors default timeout (setTimeout()) and omits the sender
Abstraction for unification of sender and senderFuture for later reply
Abstraction for unification of sender and senderFuture for later reply
Comparison only takes uuid into account.
Comparison only takes uuid into account.
This is a reference to the message currently being processed by the actor
Get the dispatcher for this actor.
Get the dispatcher for this actor.
Sets the dispatcher for this actor.
Sets the dispatcher for this actor. Needs to be invoked before the actor is started.
Shuts down the actor its dispatcher and message queue.
Shuts down the actor its dispatcher and message queue. Alias for 'stop'.
User overridable callback/setting.
User overridable callback/setting.
Don't forget to supply a List of exception types to intercept (trapExit)
Can be one of:
faultHandler = AllForOneStrategy(trapExit = List(classOf[Exception]), maxNrOfRetries, withinTimeRange)Or:
faultHandler = OneForOneStrategy(trapExit = List(classOf[Exception]), maxNrOfRetries, withinTimeRange)
Forwards the message and passes the original sender actor as the sender.
Forwards the message and passes the original sender actor as the sender.
Works with '!', '!!' and '!!!'.
Akka Java API.
Akka Java API.
Forwards the message specified to this actor and preserves the original sender of the message
Java API.
Java API.
Abstraction for unification of sender and senderFuture for later reply
Java API.
Java API.
Returns an unmodifiable Java Map containing the linked actors, please note that the backing map is thread-safe but not immutable
Akka Java API.
Akka Java API.
The reference sender Actor of the last received message. Is defined if the message was sent from another Actor, else None.
Akka Java API.
Akka Java API.
The reference sender future of the last received message. Is defined if the message was sent with sent with '!!' or '!!!', else None.
Akka Java API.
Akka Java API.
Returns the supervisor, if there is one.
Returns the uuid for the actor.
Returns the uuid for the actor.
Returns on which node this actor lives if None it lives in the local ActorRegistry
Returns on which node this actor lives if None it lives in the local ActorRegistry
Holds the hot swapped partial function.
User overridable callback/setting.
User overridable callback/setting.
Identifier for actor, does not have to be a unique one. Default is the 'uuid'.
This field is used for logging, AspectRegistry.actorsFor(id), identifier for remote actor in RemoteServer etc.But also as the identifier for persistence, which means that you can use a custom name to be able to retrieve the "correct" persisted state upon restart, remote restart etc.
Callback for the dispatcher.
Callback for the dispatcher. This is the single entry point to the user Actor implementation.
Is the actor being restarted?
Is the actor being restarted?
Query actor's current receive behavior.
Query actor's current receive behavior.
Is the actor running?
Is the actor running?
Is the actor shut down?
Is the actor shut down?
Is the actor ever started?
Is the actor ever started?
User overridable callback/setting.
User overridable callback/setting.
Defines the life-cycle for a supervised actor.
Links an other actor to this actor.
Links an other actor to this actor. Links are unidirectional and means that a the linking actor will receive a notification if the linked actor has crashed.
If the 'trapExit' member field of the 'faultHandler' has been set to at contain at least one exception class then it will 'trap' these exceptions and automatically restart the linked actors according to the restart strategy defined by the 'faultHandler'.
To be invoked from within the actor itself.
Returns an unmodifiable Java Map containing the linked actors, please note that the backing map is thread-safe but not immutable
Returns an unmodifiable Java Map containing the linked actors, please note that the backing map is thread-safe but not immutable
Returns the mailbox.
Returns the mailbox.
User overridable callback/setting.
User overridable callback/setting.
Defines the default timeout for an initial receive invocation. When specified, the receive function should be able to handle a 'ReceiveTimeout' message.
Use self.reply(..)
to reply with a message to the original sender of the message currently
being processed.
Use self.reply(..)
to reply with a message to the original sender of the message currently
being processed. This method fails if the original sender of the message could not be determined with an
IllegalStateException.
If you don't want deal with this IllegalStateException, but just a boolean, just use the tryReply(...)
version.
Throws an IllegalStateException if unable to determine what to reply to.
Try to send an exception.
Try to send an exception. Not all channel types support this, one notable positive example is Future. Failure to send is silent.
whether sending was successful
The reference sender Actor of the last received message.
The reference sender Actor of the last received message. Is defined if the message was sent from another Actor, else None.
The reference sender future of the last received message.
The reference sender future of the last received message. Is defined if the message was sent with sent with '!!' or '!!!', else None.
Akka Java API.
Akka Java API.
The default dispatcher is the Dispatchers.globalExecutorBasedEventDrivenDispatcher. This means that all actors will share the same event-driven executor based dispatcher.
You can override it so it fits the specific use-case that the actor is used for. See the akka.dispatch.Dispatchers class for the different dispatchers available.
The default is also that all actors that are created and spawned from within this actor is sharing the same dispatcher as its creator.
User overridable callback/setting.
User overridable callback/setting.
Don't forget to supply a List of exception types to intercept (trapExit)
Can be one of:
faultHandler = AllForOneStrategy(trapExit = List(classOf[Exception]), maxNrOfRetries, withinTimeRange)Or:
faultHandler = OneForOneStrategy(trapExit = List(classOf[Exception]), maxNrOfRetries, withinTimeRange)
User overridable callback/setting.
User overridable callback/setting.
Identifier for actor, does not have to be a unique one. Default is the 'uuid'.
This field is used for logging, AspectRegistry.actorsFor(id), identifier for remote actor in RemoteServer etc.But also as the identifier for persistence, which means that you can use a custom name to be able to retrieve the "correct" persisted state upon restart, remote restart etc.
User overridable callback/setting.
User overridable callback/setting.
Defines the life-cycle for a supervised actor.
Akka Java API.
Akka Java API.
Defines the default timeout for an initial receive invocation. When specified, the receive function should be able to handle a 'ReceiveTimeout' message.
Atomically create (from actor class) and start an actor.
Atomically create (from actor class) and start an actor.
To be invoked from within the actor itself.
Atomically create (from actor class) and start an actor.
Atomically create (from actor class) and start an actor.
Atomically create (from actor class), start and link an actor.
Atomically create (from actor class), start and link an actor.
To be invoked from within the actor itself.
Atomically create (from actor class), start and link an actor.
Atomically create (from actor class), start and link an actor.
Atomically create (from actor class), start, link and make an actor remote.
Atomically create (from actor class), start, link and make an actor remote.
To be invoked from within the actor itself.
Atomically create (from actor class), start, link and make an actor remote.
Atomically create (from actor class), start, link and make an actor remote.
Atomically create (from actor class), start and make an actor remote.
Atomically create (from actor class), start and make an actor remote.
To be invoked from within the actor itself.
Atomically create (from actor class), start and make an actor remote.
Atomically create (from actor class), start and make an actor remote.
Starts up the actor and its message queue.
Starts up the actor and its message queue.
Atomically start and link an actor.
Atomically start and link an actor.
To be invoked from within the actor itself.
Shuts down the actor its dispatcher and message queue.
Shuts down the actor its dispatcher and message queue.
Returns the supervisor, if there is one.
Returns the supervisor, if there is one.
Override to check whether the new supervisor is running on the CallingThreadDispatcher, as it should be.
Override to check whether the new supervisor is running on the CallingThreadDispatcher, as it should be. This can of course be tricked by linking before setting the dispatcher before starting the supervisor, but then you just asked for trouble.
Java API.
Java API.
Sends the specified message to the channel, i.e. fire-and-forget semantics, including the sender reference if possible (not supported on all channels).
actor.tell(message, context);
Java API.
Java API.
Sends the specified message to the channel, i.e. fire-and-forget semantics.
actor.tell(message);
Use getContext().tryReply(..)
to reply with a message to the original sender of the message currently
being processed.
Use getContext().tryReply(..)
to reply with a message to the original sender of the message currently
being processed.
Returns true if reply was sent, and false if unable to determine what to reply to.
Scala and Java API.
Scala and Java API.
Try to send the specified message to the channel, i.e. fire-and-forget semantics, including the sender reference if possible (not supported on all channels).
From Java:
actor.tryTell(message); actor.tryTell(message, context);
From Scala:
actor tryTell message actor.tryTell(message)(sender)
Retrieve reference to the underlying actor, where the static type matches the factory used inside the constructor.
Retrieve reference to the underlying actor, where the static type matches the factory used inside the constructor. Beware that this reference is discarded by the ActorRef upon restarting the actor (should this reference be linked to a supervisor). The old Actor may of course still be used in post-mortem assertions.
Unlink the actor.
Unlink the actor.
To be invoked from within the actor itself.
Returns the uuid for the actor.
Returns the uuid for the actor.
Only for internal use.
Sends a message asynchronously and waits on a future for a reply message.
Sends a message asynchronously and waits on a future for a reply message.
It waits on the reply either until it receives it (in the form of Some(replyMessage)
)
or until the timeout expires (which will return None). E.g. send-and-receive-eventually semantics.
NOTE:
Use this method with care. In most cases it is better to use '!' together with the 'sender' member field to
implement request/response message exchanges.
If you are sending messages using !!
then you have to use self.reply(..)
to send a reply message to the original sender. If not then the sender will block until the timeout expires.
use (actor ? msg).as[T]
instead
Sends a message asynchronously returns a future holding the eventual reply message.
Sends a message asynchronously returns a future holding the eventual reply message.
NOTE:
Use this method with care. In most cases it is better to use '!' together with the 'sender' member field to
implement request/response message exchanges.
If you are sending messages using !!!
then you have to use self.reply(..)
to send a reply message to the original sender. If not then the sender will block until the timeout expires.
return type is an illusion, use the more honest ? method
Returns the class for the Actor instance that is managed by the ActorRef.
Returns the class for the Actor instance that is managed by the ActorRef.
Will be removed without replacement, doesn't make any sense to have in the face of become
and unbecome
Returns the class name for the Actor instance that is managed by the ActorRef.
Returns the class name for the Actor instance that is managed by the ActorRef.
Will be removed without replacement, doesn't make any sense to have in the face of become
and unbecome
Akka Java API.
Akka Java API.
Returns the class for the Actor instance that is managed by the ActorRef.
Will be removed without replacement, doesn't make any sense to have in the face of become
and unbecome
Akka Java API.
Akka Java API.
Returns the class name for the Actor instance that is managed by the ActorRef.
Will be removed without replacement, doesn't make any sense to have in the face of become
and unbecome
Java API.
Java API.
Remoting will become fully transparent in the future
Akka Java API.
Akka Java API.
Returns the mailbox size.
Use actorref.dispatcher.mailboxSize(actorref)
Will be replaced by implicit-scoped timeout on all methods that needs it, will default to timeout specified in config
Returns the mailbox size.
Returns the mailbox size.
Use actorref.dispatcher.mailboxSize(actorref)
Akka Java API.
Akka Java API.
Use getContext().replySafe(..)
to reply with a message to the original sender of the message currently
being processed.
Returns true if reply was sent, and false if unable to determine what to reply to.
replaced by tryReply
Akka Java API.
Akka Java API.
Use getContext().replyUnsafe(..)
to reply with a message to the original sender of the message currently
being processed.
Throws an IllegalStateException if unable to determine what to reply to.
replaced by reply
Use reply_?(..)
to reply with a message to the original sender of the message currently
being processed.
Use reply_?(..)
to reply with a message to the original sender of the message currently
being processed.
Returns true if reply was sent, and false if unable to determine what to reply to.
Use tryReply(..)
Java API.
Java API.
Sends the specified message to the channel, i.e. fire-and-forget semantics, including the sender reference if possible (not supported on all channels).
actor.sendOneWay(message, context);
Use 'tell' instead
Sends the specified message to the channel, i.
Sends the specified message to the channel, i.e. fire-and-forget semantics.
actor.sendOneWay(message);
Use 'tell' instead
Java API.
Java API.
Try to send the specified message to the channel, i.e. fire-and-forget semantics, including the sender reference if possible (not supported on all channels).
actor.sendOneWay(message, context);
Use 'tryTell' instead
Java API.
Java API.
Try to send the specified message to the channel, i.e. fire-and-forget semantics.
actor.sendOneWay(message);
Use 'tryTell' instead
Akka Java API.
Akka Java API.
Sends a message asynchronously and waits on a future for a reply message under the hood.
It waits on the reply either until it receives it or until the timeout expires (which will throw an ActorTimeoutException). E.g. send-and-receive-eventually semantics.
NOTE: Use this method with care. In most cases it is better to use 'tell' together with 'getContext().getSender()' to implement request/response message exchanges.
If you are sending messages using sendRequestReply
then you have to use getContext().reply(..)
to send a reply message to the original sender. If not then the sender will block until the timeout expires.
Will be removed in 2.0, use 'ask().get()' for blocking calls
Akka Java API.
Akka Java API.
Will be removed in 2.0, use 'ask().get()' for blocking calls
sendRequestReply(message: AnyRef, timeout: Long, sender: ActorRef) Uses the default timeout of the Actor (setTimeout())
Akka Java API.
Akka Java API.
Will be removed in 2.0, use 'ask().get()' for blocking calls
sendRequestReply(message: AnyRef, timeout: Long, sender: ActorRef) Uses the default timeout of the Actor (setTimeout()) and omits the sender reference
Akka Java API.
Akka Java API.
Sends a message asynchronously returns a future holding the eventual reply message.
NOTE: Use this method with care. In most cases it is better to use 'tell' together with the 'getContext().getSender()' to implement request/response message exchanges.
If you are sending messages using sendRequestReplyFuture
then you have to use getContext().reply(..)
to send a reply message to the original sender. If not then the sender will block until the timeout expires.
Use 'ask' instead, this method will be removed in the future
Akka Java API.
Akka Java API.
Use 'ask' instead, this method will be removed in the future
sendRequestReplyFuture(message: AnyRef, sender: ActorRef): Future[_] Uses the Actors default timeout (setTimeout())
Akka Java API.
Akka Java API.
Use 'ask' instead, this method will be removed in the future
sendRequestReplyFuture(message: AnyRef, sender: ActorRef): Future[_] Uses the Actors default timeout (setTimeout()) and omits the sender
User overridable callback/setting.
User overridable callback/setting.
Defines the default timeout for '!!' and '!!!' invocations, e.g. the timeout for the future returned by the call to '!!' and '!!!'.
Will be replaced by implicit-scoped timeout on all methods that needs it, will default to timeout specified in config
User overridable callback/setting.
User overridable callback/setting.
Defines the default timeout for '!!' and '!!!' invocations, e.g. the timeout for the future returned by the call to '!!' and '!!!'.
Will be replaced by implicit-scoped timeout on all methods that needs it, will default to timeout specified in config
This special ActorRef is exclusively for use during unit testing in a single-threaded environment. Therefore, it overrides the dispatcher to CallingThreadDispatcher and sets the receiveTimeout to None. Otherwise, it acts just like a normal ActorRef. You may retrieve a reference to the underlying actor to test internal logic.
1.1