TracNav
AS3 MultiCore : PipeWorks...
- Downloads
- Installation
- Release Notes
- Live Demo
- View Source
- Discussion
Project Owner...
- Cliff Hall
Utilities Used...
- Pipes
PureMVC AS3 MultiCore / Flex Demo - PipeWorks
This demo illustrates usage of the PureMVC AS3 MultiCore Framework and the MultiCore Pipes Utility using Flex Modules.
Scope
- The focus of this demo is on intermodular communications between PureMVC Cores using the MultiCore Pipes utility. While the modules used could be refactored to a separate codebase, compiled into SWFs and loaded dynamically at runtime. However, they are simply instantiated when needed inside this demo. This means a simple compile of the main app will do, and there is no need to compile the modules separately.
Techniques Illustrated
- There are 2 types of modules in the app: one will be instantiated as many times as you like, the other only once.
- A fully functional cross-module, multi-level error/info/debug logger is implemented.
- A fully functional RSS feed reader that parses ATOM1.0, RSS1.0 and RSS2.0 is implemented.
- The main application or 'Shell' will coordinate instantiation of modules and interconnect them using named, directional pipes.
- The module that is instantiated multiple times primarily generates messages, while the other primarily consumes them.
- They all communicate with the Shell, which produces and consumes messages as well.
- Use of a Filter to consume a control message and subsequently change its behavior with regard to the messages passing through it.
Prattlers
The Main application (Shell) allows instantiation of multiple instances of an RSS feed reader module, which read and parse random feeds, and display their entries one at a time at an adjustable 'reading rate'. In addition to being fully functional clients communicating with services and doing non-trivial parsing of three different types of RSS feeds, these modules prattle a lot! They produce copious quantities of log messages. Everything from errors to key state change info to detailed debug information is generated, and the more of them you launch the more massive the message stream. They're called Prattlers.
Logger
The Main app instantiates a single instance of a Logger module, which it connects each new feed reader to via pipes. It exports to the main application 2 UI components - a button that always displays the current number of messages, and a window (opened by that button) that displays the messages in a window.
Log Level Filter
The pipes from the various readers are merged and passed through a filter which rejects them if they are above the currently set log level. The Main app has a combo box that allows the selection of the desired log level, and it sends a sepecial FilterControlMessage to that filter telling it to change it's log level parameter to the new value. Thus you can see how to throttle or modify traffic on a pipe by sending messages to a filter on that pipe. No need to keep a reference to the Filter itself, it has a name and you can address messages to it.
Junctions
PipeWorks also illustrates the use of Pipe Junctions to create named, directional pipes. The Module creates a Mediator that keeps the reference to the Junction for that module. Any incoming communcations from other modules is handled there, as well as Notifications from elsewhere in the module or 'Core' requesting outgoing messages be sent.
