MessageHandlers

(This tag must be placed inside an <EventMap> tag)

The MessageHandlers tag allows you to register a list of handlers as a consumer of a Flex Messaging Service. All the tags inside the MessageHandlers tag will be executed in order when a Message matching the criteria is received. This tag accepts the same attributes as the <mx:Consumer> tag.

<MessageHandlers destination="YourGateway">
   ... here what you want to happen when this message is received ...
</MessageHandlers>

The above example would be the same as doing the following:

<mx:Consumer destination="YourGateway" />

You would also need to create event handlers for the message and fault. That is not necessary when using the MessageHandlers tag. Inner tags such as MethodInvoker are executed when the message is received. If you need to handle a fault, you can use the faultHandlers inner tag. See "Handling a subscription fault".

Attributes

debug

Boolean

Whether to show debugging information for this handlers block. If true, Console output will show debugging information as the list runs.

Other attributes

See mx.messaging.Consumer for a list of attributes.

Inner tags

faultHandlers

A list of handlers to run if the subscription attempt throws an error. See "Handling a subscription fault" below.

Other allowed inner tags:

Handling a subscription fault

When the MessageHandlers tag is placed in the EventMap, it automatically subscribes to the destination provided. The subscription attempt may throw an error (ie: attempting to subscribe to a subtopic in a channel that doesn't accept subtopics). If you want to perform some action when the subscription cannot be made, you can use a <faultHandlers> inner tag. Inside that handlers list, you can use the same tags you would in the main body of an <EventHandlers> or <MessageHandlers> tag.

10 responses

  1. Would be nice to be able to specify clientID for subscription.
  2. For those using BlazeDS and Mate:

    Is anyone else getting a Type #1009 error from their MessageHander after switching to Flex 3.2 from Flex 3.1? The root cause is some null value in the ServerConfig.as.

    Works fine in 3.1, breaks horribly in 3.2. :/
  3. Dyre,<br />Do you think it has anything to do with this?<br /><a rel="nofollow" href="http://bugs.adobe.com/jira/browse/BLZ-300">http://bugs.adobe.com/jira/browse/BLZ-300</a>;
  4. Yep. That's the problem exactly. <br /><br />Unfortunately, it looks like they only fixed it on trunk, rather than their release branches.<br /><br />Thanks for the link, Laura ^_^
  5. Hi, <br />I am couple of weeks old doing flex :-)<br /><br />I was evaluating Mate for our team and have run into an issue wrt to MessageHandlers.... When I use this tag the application never comes up/ loads on screen. Now I know it auto subscribes. So i turned off auto subscription and it works. (I don't know how to turn it back on later so have not tested that yet).<br /><br />But point being if I use Action Script or m:consumer tag my stuff works fine. The remote channel is active and working fine. Only the MessageHandler is doing something funky... following is my code...<br /><br /> &lt;MessageHandlers destination=&quot;feed&quot; autoSubscribe=&quot;true&quot; debug=&quot;true&quot;&gt;<br /> &lt;MethodInvoker generator=&quot;{FeedViewManager}&quot; method=&quot;processRecievedQuoteEvent&quot; arguments=&quot;{resultObject}&quot; /&gt;<br /> &lt;faultHandlers&gt;<br /> &lt;MethodInvoker generator=&quot;{FeedViewManager}&quot; method=&quot;processFault&quot; arguments=&quot;{resultObject}&quot;/&gt;<br /> &lt;/faultHandlers&gt;<br /><br /> &lt;/MessageHandlers&gt;<br /><br />I am not sure yet how to see application level faul;t logs...(sorry java background) tells me I should be something somewhere. If anybody can point me to right direction...much appreciated.<br /><br />Thanks,<br />Vineet
  6. I got my debugger going ... The problem is same as what Dyre reported.<br /><br />TypeError: Error #1009: Cannot access a property or method of a null object reference.<br /><br /><br />This brings up another question.... How do I get a handle on MessageHandler from outside of MainEventMap file. (Maybe should not be done at all.) but still what would be the work around currently in Mate.... as in dont subscribe and then subscribe at a later stage?<br /><br />Cheers!<br />Vineet
  7. Hi there. I ended up solving my problem by back-porting their bug fix for BLZ-300 from Flex 4.0 to my local copy of Flex 3.2. There's an NPE in ServerConfig.as on line 519 that is easily fixed.
  8. Hi folks,<br />Currently i am working on producer, consumer in my project.Actually i have not yet implemented <a href="MessageHandlers</a>">http://mate.asfusion.com/page/documentation/tags/messagehandlers">MessageHandlers</a>; and i so much curious to see the functionality of <a href="MessageHandlers</a>">http://mate.asfusion.com/page/documentation/tags/messagehandlers">MessageHandlers</a>;, how it works like producer and consumer. so please can i have any example,which is based on <a href="MessageHandlers</a>">http://mate.asfusion.com/page/documentation/tags/messagehandlers">MessageHandlers</a>;. It will help me lot.<br /><br />Thanks &amp; Regard:<br />Gourav Rai
  9. Vin,<br /><br />We had a similar problem where the mx:Consumer works, but Mate's MessageHandler would not.<br /><br />Apparently the MessageHandler tries to subscribe twice (!) during its initialization process after which the mx:Concumer refuses to work.<br /><br />We submitted a fix to Mate for this. Anyway, find our fixed MessageHandler here:<br /><br />/*<br />Copyright 2008 Nahuel Foronda/AsFusion<br /><br />Licensed under the Apache License, Version 2.0 (the &quot;License&quot;); <br />you may not use this file except in compliance with the License. Y<br />ou may obtain a copy of the License at<br /><br /><a rel="nofollow" href="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</a>; <br /><br />Unless required by applicable law or agreed to in writing, s<br />oftware distributed under the License is distributed on an &quot;AS IS&quot; BASIS, <br />WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <br />See the License for the specific language governing permissions and limitations under the License<br /><br />Author: Nahuel Foronda, Principal Architect<br /> nahuel at asfusion dot com<br /> <br />@ignore<br />*/<br />package com.asfusion.mate.actionLists<br />{&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;import com.asfusion.mate.events.UnhandledMessageFaultEvent;<br />&nbsp;&nbsp;&nbsp;import com.asfusion.mate.utils.debug.DebuggerUtil;<br />&nbsp;&nbsp;&nbsp;import com.asfusion.mate.core.mate;<br />&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;import mx.messaging.*;<br />&nbsp;&nbsp;&nbsp;import mx.messaging.events.MessageEvent;<br />&nbsp;&nbsp;&nbsp;import mx.messaging.events.MessageFaultEvent;<br />&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;use namespace mate;<br />&nbsp;&nbsp;&nbsp;/**<br />&nbsp;&nbsp;&nbsp; * The &lt;code&gt;MessageHandlers&lt;/code&gt; tag allows you to register a set of handlers as a consumer of a Flex Messaging Service. <br />&nbsp;&nbsp;&nbsp; * All the tags inside the &lt;code&gt;MessageHandlers&lt;/code&gt; tag will be executed in order when a &lt;code&gt;Message&lt;/code&gt; matching the <br />&nbsp;&nbsp;&nbsp; * criteria is received. This tag accepts the same attributes as the &lt;code&gt;Consumer&lt;/code&gt; tag.<br />&nbsp;&nbsp;&nbsp; */<br />&nbsp;&nbsp;&nbsp;public class MessageHandlers extends AbstractHandlers<br />&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/**<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; * An internal reference to the Consumer instance<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; */<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;protected var consumer:Consumer;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/*-----------------------------------------------------------------------------------------------------------<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;* Public Setters and Getters<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-------------------------------------------------------------------------------------------------------------*/<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/*-.........................................autoSubscribe ..........................................*/<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/**<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; * If this flag is true the consumer will be automatically subscribed when the &lt;code&gt;MessageHandlers&lt;/code&gt; is created.<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; */<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;private var _autoSubscribe:Boolean = true;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;private var _consumerSubscribedCalled:Boolean = false;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;public function get autoSubscribe ():Boolean<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return _autoSubscribe;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;public function set autoSubscribe (value:Boolean):void<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;_autoSubscribe = value;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/*-.........................................destination ..........................................*/<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/**<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; * Provides access to the destination for the &lt;code&gt;MessageAgent&lt;/code&gt;. Changing the destination will disconnect the <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; * &lt;code&gt;MessageAgent&lt;/code&gt; if it is currently connected.<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; */<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;public function get destination ():String<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return consumer.destination;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;public function set destination (value:String):void<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;consumer.destination = value;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;invalidateProperties();<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/*-.........................................selector..........................................*/<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/**<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; * The selector for the Consumer. This is an expression that is passed to the destination which<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; * uses it to filter the messages delivered to the Consumer.<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; * <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; * &lt;p&gt;Before a call to the subscribe() method, this property can be set with no side effects. <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; * After the Consumer has subscribed to its destination, changing this value has the side effect<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; * of updating the Consumer's subscription to use the new selector expression immediately.&lt;/p&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; * <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; * &lt;p&gt;The remote destination must understand the value of the selector expression.&lt;/p&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; */<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;public function get selector():String<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return consumer.selector;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;public function set selector(value:String):void<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;consumer.selector = value;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;invalidateProperties();<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/*-.........................................subtopic..........................................*/<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/**<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; * Provides access to the subtopic for the remote destination that the MessageAgent uses.<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; */<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;public function get subtopic():String<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return consumer.subtopic;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;public function set subtopic(value:String):void<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;consumer.subtopic = value;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;invalidateProperties();<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/*-.........................................resubscribeAttempts..........................................*/<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/**<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; * The number of resubscribe attempts that the Consumer makes in the event that the destination is unavailable <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; * or the connection to the destination fails. A value of -1 enables infinite attempts. <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; * A value of zero disables resubscribe attempts.<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; * <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; * &lt;p&gt;Resubscribe attempts are made at a constant rate according to the resubscribe interval value. <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; * When a resubscribe attempt is made if the underlying channel for the Consumer is not connected or attempting<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; * to connect the channel will start a connect attempt. Subsequent Consumer resubscribe attempts that occur while <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; * the underlying channel connect attempt is outstanding are effectively ignored until the outstanding <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; * channel connect attempt succeeds or fails.&lt;/p&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; */<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;public function get resubscribeAttempts():int<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return consumer.resubscribeAttempts;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;public function set resubscribeAttempts(value:int):void<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;consumer.resubscribeAttempts = value;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/*-.........................................resubscribeInterval..........................................*/<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/**<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; * The number of milliseconds between resubscribe attempts. If a Consumer doesn't receive an acknowledgement<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; * for a subscription request, it will wait the specified number of milliseconds before attempting to resubscribe.<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; * Setting the value to zero disables resubscriptions.<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; * <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; * &lt;p&gt;Resubscribe attempts are made at a constant rate according to this value. <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; * When a resubscribe attempt is made if the underlying channel for the Consumer is not connected or <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; * attempting to connect the channel will start a connect attempt. Subsequent Consumer resubscribe attempts<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; * that occur while the underlying channel connect attempt is outstanding are effectively ignored until <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; * the outstanding channel connect attempt succeeds or fails.&lt;/p&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; */<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;public function get resubscribeInterval():int<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return consumer.resubscribeInterval;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;public function set resubscribeInterval(value:int):void<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;consumer.resubscribeInterval = value;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/*-.........................................faultHandlers..........................................*/<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;private var _faultHandlers:Array;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/**<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; * &nbsp;&nbsp;&nbsp;An array of actions (IAction) contained in this fault action-list. <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; * If the consumer dispatches a &lt;code&gt;faultEvent&lt;/code&gt;, <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; * the handlers are processed in the order in which they were added to the list.<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; * <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; * @default null<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; * */<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;public function get faultHandlers():Array<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return _faultHandlers;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[ArrayElementType(&quot;com.asfusion.mate.actions.IAction&quot;)]<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;public function set faultHandlers(value:Array):void<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;_faultHandlers = value;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/*-----------------------------------------------------------------------------------------------------------<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;* Constructor<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-------------------------------------------------------------------------------------------------------------*/&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/**<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; * Constructor<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; */<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;public function MessageHandlers()<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;super();<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;getConsumer();<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/*-.........................................getConsumer..........................................*/<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/**<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; * Returns an instance of the &lt;code&gt;Consumer&lt;/code&gt; used in this &lt;code&gt;MessageHandlers&lt;/code&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; */<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;public function getConsumer():Consumer<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if(!consumer)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;consumer = new Consumer();<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;consumer.addEventListener(MessageEvent.MESSAGE, fireEvent,false,0,true);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;consumer.addEventListener(MessageFaultEvent.FAULT, fireFaultEvent,false,0,true);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return consumer;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/*-.........................................subscribe..........................................*/<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/**<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; * Subscribes to the remote destination.<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; */<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;public function subscribe(clientId:String = null):void<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;consumer.subscribe(clientId);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/*-.........................................unsubscribe..........................................*/<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/**<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; * Unsubscribes from the remote destination. In the case of durable JMS subscriptions, <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; * this will destroy the durable subscription on the JMS server.<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; */<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;public function unsubscribe():void<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;consumer.unsubscribe();<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/*-----------------------------------------------------------------------------------------------------------<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;* Override Public methods<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-------------------------------------------------------------------------------------------------------------*/<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/*-.........................................toString..........................................*/<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/**<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; * @inheritDoc<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; */ <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;override public function errorString():String<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var str:String = &quot;Destination:&quot;+ destination + &quot;. Error was found in a MessageHandlers list in file &quot; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;+ DebuggerUtil.getClassName(document);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return str;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/*-.........................................clearReferences..........................................*/<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/**<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; * @inheritDoc<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*/<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;override public function clearReferences():void<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;consumer.unsubscribe();<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;consumer.removeEventListener(MessageEvent.MESSAGE, fireEvent);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;consumer.removeEventListener(MessageFaultEvent.FAULT, fireFaultEvent);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/*-----------------------------------------------------------------------------------------------------------<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;* Protected methods<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-------------------------------------------------------------------------------------------------------------*/<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/*-.........................................fireFaultEvent..........................................*/<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/**<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; * Called by the consumer when the fault event gets triggered.<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; * This method creates a scope and then runs the sequence.<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*/<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;protected function fireFaultEvent(event:MessageFaultEvent):void<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if(faultHandlers &amp;&amp; faultHandlers.length &gt; 0)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var currentScope:MessageScope = new MessageScope(event,debug, map, inheritedScope);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;currentScope.owner = this;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;currentScope.message = event.message;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;currentScope.currentEvent = event;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;runSequence(currentScope, faultHandlers);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var faultEvent:UnhandledMessageFaultEvent = new UnhandledMessageFaultEvent(UnhandledMessageFaultEvent.FAULT);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;faultEvent.faultCode = event.faultCode;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;faultEvent.faultDetail = event.faultDetail;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;faultEvent.faultString = event.faultString;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;faultEvent.message = event.message;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;faultEvent.rootCause = event.rootCause;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;dispatcher.dispatchEvent(faultEvent);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/*-.........................................fireEvent..........................................*/<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/**<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; * Called by the consumer when the message event gets triggered.<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; * This method creates a scope and then runs the sequence.<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*/<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;protected function fireEvent(event:MessageEvent):void<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var currentScope:MessageScope = new MessageScope(event,debug, map, inheritedScope);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;currentScope.owner = this;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;currentScope.message = event.message;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;currentScope.currentEvent = event;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;runSequence(currentScope, actions);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/*-----------------------------------------------------------------------------------------------------------<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;* Override Protected methods<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-------------------------------------------------------------------------------------------------------------*/<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/*-.........................................commitProperties..........................................*/<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/**<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; * Processes the properties set on the component.<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*/<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;override protected function commitProperties():void<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if(autoSubscribe)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (!_consumerSubscribedCalled)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;consumer.subscribe();<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;_consumerSubscribedCalled = true;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;}<br />}
  10. Newbie question, I understand MessageHandler is the Mate equivalent to the Consumer tag but what is the Mate equivalent to the Producer tag?

Comments now closed