Table of Contents
Messaging Architecture
The messaging APIs in Flex allows an application connect to a message destination, send messages to it, and receive messages from other messaging clients. Those messaging clients can be Flex applications or other types of clients, such as Java Message Service (JMS) clients or clients in other languages.
Message Service
The four components of the messaging architecture are:
- Channels
- Destinations
- Producers
- Consumers
The messaging framework provides an abstraction on top of the transport protocols that the Flash Player supports, such as Action Message Format (AMF), Real-Time Messaging Protocol (RTMP), and XMLSocket. You configure the Message Service to transport messages over one or more channels.
Agents
Message producers and consumers, collectively called message agents, exchange messages through a common destination, the message broker. The messaging framework composes a message on the client when an operation is performed. For example, a text message is published to a message service destination or a remote method is invoked on an RPC service.
Clients
- Flex Consumer examples? -- various samples of the Flex Consumer API
- Flex Producer examples? -- various samples of the Flex Producer API
Channels
To send messages across the network, the agent and message broker use channels that encapsulate message formats, network protocols, and network behaviors and decouple them from services, destinations, and application code. Each channel corresponds to a specific transport protocol and has a corresponding (server-side) endpoint. When a message arrives at an endpoint, the endpoint decodes the message and passes it to a message broker, which determines where the message should be sent.
Channel Types
- AMFChannel -- Optimal for remote procedure calls (RemoteObject, proxied HTTPService or WebService) or Data Management without auto-sync.
- StreamingAMFChannel -- This channel sends a request to “open” a HTTP connection between the server and client, over which the server will write an infinite response of pushed messages.
- RTMPChannel -- Creates a single duplex socket connection to the server and gives the server the best notification of the player being shut down.
- HTTPChannel -- Exactly the same as the AMFChannel behaviorally, but serializes data in an XML format called AMFX (probably should have been named the AMFXChannel).
Message Broker
The message broker performs authorization checks and routes messages to the appropriate service based on its message type. The first service found that can process the message receives it, locates the destination the message targets, and potentially uses a service adapter if the destination requires one for back-end access. A service or service adapter can request that a message be sent to other connected clients, causing the message to flow back into the message broker and out of the appropriate endpoints to other connected clients. This is a true push operation if the channel is capable of real-time push, or it may be a polling operation if the channel relies upon a protocol that does not support real-time messaging. It could be a mix of the approaches, with some consumers polling and some accessing the data in real time, depending on how the destination's channels are configured.
Flex supports:
- publish-subscribe messaging, also know as topic-based messaging
- point-to-point messaging, also known as queue-based messaging
Publish-subscribe messaging and point-to-point messaging are the two most common types of messaging. Publish-subscribe messaging is used for applications that require a one-to-many relationship between producers and consumers. Point-to-point messaging is used for applications that require a one-to-one relationship between producers and consumers.
Servers
Popular message brokers include:
- Apache ActiveMQ (Apache 2.0 License) is a Java message broker that can be controlled from Python with pyactivemq, a Boost.Python wrapper for the ActiveMQ C++ bindings.
- Spread
Issues
References
Attachments
- messaging-arch.png (29.9 kB) - added by thijs 4 months ago.
