RPC Services vs. Messaging Service

来源:互联网 发布:渡边 知乎 编辑:程序博客网 时间:2024/05/29 08:22

 

BlazeDS uses two patterns for sending and receiving messages:

therequest/reply pattern and

the publish/subscribe pattern.

 

RemoteObject,HTTPService, and WebService components use the request/reply messagepattern, in which the Flex component makes a request and receives areply to that request.

 

The RPC components are designed for client applications in which acall and response model is a good choice for accessing external data.These components let the client make asynchronous requests to remoteservices that process the requests, and then return data to your Flexapplication.

The RPC components call a remote service, and thenstore response data from the service in an ActionScript or XML objectfrom which you obtain the data. You can use the RPC components in theclient application to work with three types of RPC services: remoteobject services with the RemoteObject component, web services with theWebService component, and HTTP services with the HTTPService component.

 

You declare RemoteObject components in MXML or ActionScript to connectto remote services. Use the RemoteObject component to call methods on aJava class or ColdFusion component.

 

 

Producer and Consumer components use thepublish/subscribe message pattern. In this pattern, the Producerpublishes a message to a destination defined on the BlazeDS server. AllConsumers subscribed to that destination receive the message.

 

The Messaging Service supports publish-subscribe messaging. Inpublish-subscribe messaging, each message can have multiple consumers.You use this type of messaging when you want more than one consumer toreceive the same message. Examples of applications that can usepublish-subscribe messaging are auction sites, stock quote services,and other applications that require one message to be sent to manysubscribers.

 

You can support point-to-pointmessaging, also known as queue-based messaging, between Flex clients byusing the JMSAdapter and bridging to a JMS queue.

The Messaging Service supports bridging BlazeDS to Java Message Service(JMS) messaging destinations by using the JMSAdapter. The JMSAdapterlets Flex clients publish messages to and consume messages from a JMSserver.The JMSAdapter supports topic-based and queue-based messaging.The JMSAdapter class lets Flex applications participate in existingmessaging-oriented middleware (MOM) systems. Therefore, a Javaapplication can publish messages to and respond to messages from Flexapplications.

JMS queues are point-to-point, unlike topics which are one-to-many.A better choice for point-to-point messaging is to use theActionScriptAdapter in conjunction with message filtering on the clientside.