Packageorg.spicefactory.parsley.core.messaging.impl
Classpublic class DefaultMessageProcessor
InheritanceDefaultMessageProcessor Inheritance Object
Implements MessageProcessor
Subclasses DefaultCommandObserverProcessor

Default implementation of the MessageProcessor interface.



Public Properties
 PropertyDefined By
  message : Message
[read-only] The message instance.
DefaultMessageProcessor
  state : MessageState
[read-only] The current state of this processor.
DefaultMessageProcessor
Protected Properties
 PropertyDefined By
  cache : MessageReceiverCache
[read-only] The receiver cache for the message type this processor handles
DefaultMessageProcessor
Public Methods
 MethodDefined 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
Protected Methods
 MethodDefined By
  
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
Property Detail
cacheproperty
cache:MessageReceiverCache  [read-only]

The receiver cache for the message type this processor handles


Implementation
    protected function get cache():MessageReceiverCache
messageproperty 
message:Message  [read-only]

The message instance.


Implementation
    public function get message():Message
stateproperty 
state:MessageState  [read-only]

The current state of this processor.


Implementation
    public function get state():MessageState
Constructor Detail
DefaultMessageProcessor()Constructor
public function DefaultMessageProcessor(message:Message, cache:MessageReceiverCache, settings:MessageSettings, receiverHandler:Function = null)

Creates a new instance.

Parameters
message: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
Method Detail
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.

Returns
Array — 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

Returns
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:

processor.senderContext.scopeManager.dispatchMessage(new MyMessage());
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.

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.