(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:
- MethodInvoker
- EventAnnouncer
- RemoteObjectInvoker
- WebServiceInvoker
- HTTPServiceInvoker
- ResponseAnnouncer
- DataCopier
- StopHandlers
- ServiceResponseAnnouncer
- ObjectBuilder
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.
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. :/