Package | org.spicefactory.parsley.core.messaging.impl |
Class | public class DefaultMessageProcessor |
Inheritance | DefaultMessageProcessor Object |
Implements | MessageProcessor |
Subclasses | DefaultCommandObserverProcessor |
Property | Defined By | ||
---|---|---|---|
message : Message [read-only]
The message instance. | DefaultMessageProcessor | ||
state : MessageState [read-only]
The current state of this processor. | DefaultMessageProcessor |
Property | Defined By | ||
---|---|---|---|
cache : MessageReceiverCache [read-only]
The receiver cache for the message type this processor handles
| DefaultMessageProcessor |
Method | Defined By | ||
---|---|---|---|
DefaultMessageProcessor(message:Message, cache:MessageReceiverCache, settings:MessageSettings, receiverHandler:Function = null)
Creates a new instance. | DefaultMessageProcessor | ||
cancel():void
Cancels processing of this message. | DefaultMessageProcessor | ||
proceed():void | DefaultMessageProcessor | ||
resume():void
Resumes with message processing, invoking the next receiver. | DefaultMessageProcessor | ||
rewind():void
Rewinds the processor so it will start with the first interceptor or handler again
the next time the proceed method gets invoked. | DefaultMessageProcessor | ||
sendResponse(msg:Object, selector:* = null):void
Sends the response to the Context the message originated from. | DefaultMessageProcessor | ||
suspend():void
Suspends processing of the message. | DefaultMessageProcessor |
Method | Defined By | ||
---|---|---|---|
fetchReceivers():Array
Fetches the receivers for the message type and receiver kind this processor handles. | DefaultMessageProcessor | ||
getLogString(action:String, receiverCount:int):String
Return a string that can be used to describe the message handled by this processor. | DefaultMessageProcessor |
cache | property |
cache:MessageReceiverCache
[read-only] The receiver cache for the message type this processor handles
protected function get cache():MessageReceiverCache
message | property |
message:Message
[read-only] The message instance.
public function get message():Message
state | property |
state:MessageState
[read-only] The current state of this processor.
public function get state():MessageState
DefaultMessageProcessor | () | Constructor |
public function DefaultMessageProcessor(message:Message, cache:MessageReceiverCache, settings:MessageSettings, receiverHandler:Function = null)
Creates a new instance.
Parametersmessage:Message — the message and its settings
| |
cache:MessageReceiverCache — the receiver selection cache corresponding to the messageType
| |
settings:MessageSettings — the settings for this processor
| |
receiverHandler:Function (default = null ) — the function to invoke for each processed receiver
|
cancel | () | method |
public function cancel():void
Cancels processing of this message. No further handlers will be invoked and all resources associated with this message are disposed.
fetchReceivers | () | method |
protected function fetchReceivers():Array
Fetches the receivers for the message type and receiver kind this processor handles.
ReturnsArray — the receivers for the message type and receiver kind this processor handles
|
getLogString | () | method |
protected function getLogString(action:String, receiverCount:int):String
Return a string that can be used to describe the message handled by this processor.
Parameters
action:String — a string describing the action that will be logged, like 'Dispatch', 'Resume' or 'Cancel'
| |
receiverCount:int — the number of remaining receivers this processor will handle
|
String — a string that can be used to describe the message handled by this processor
|
proceed | () | method |
public function proceed():void
resume | () | method |
public function resume():void
Resumes with message processing, invoking the next receiver.
May only be called after suspend
has been called on this processor
rewind | () | method |
public function rewind():void
Rewinds the processor so it will start with the first interceptor or handler again the next time the proceed method gets invoked. Calling this method also causes all receivers to be refetched from the registry and thus takes into account any new receivers registered after processing this message started.
sendResponse | () | method |
public function sendResponse(msg:Object, selector:* = null):void
Sends the response to the Context the message originated from.
It does not send this message to the sending object instance only, as this would not be very
helpful in most cases. Essentially this method is just a short cut for calling:
Note that the response is dispatched through all scopes of the Context of the sending instance,
including the global scope. Therefor for point-to-point messaging the receiver of the response
should listen to the local scope (or a custom scope) instead.
processor.senderContext.scopeManager.dispatchMessage(new MyMessage());
Parameters
msg:Object — the message to dispatch
| |
selector:* (default = null ) — the selector to use if it cannot be determined from the message instance itself
|
suspend | () | method |
public function suspend():void
Suspends processing of the message. No further handlers will be invoked
before resume
gets called on this processor.
To permanently discard this message call cancel
to free
all resources associated with this message.