SCEA之路--8. Messaging

原创 2004年08月23日 23:44:00

General.
Synchronous communication.
Synchronous communication represents a tight coupling between a sender and receiver :
• the sender and receiver must both be available – i.e. real-time communication
• the sender will block until the response is available
• communication is one-to-one
• sender / receiver have some knowledge of each other – e.g. location, protocol, methods, etc.
• the sender is responsible for dealing with failures - e.g. retries, etc. “request/response” is an example of a synchronous communication paradigm.
Example : a browser sends a request to a web server and “waits” for the response. The “wait” can be indefinite or until a timeout occurs.
Asynchronous communication.
Asynchronous communication represents a loose coupling between senders / receivers :
• sender and receiver communicate via a midde-man / broker / mediator
• no requirement for sender or receiver to both be available – i.e. deferred communication
• sender doesn’t wait for a response (if any)
• communication can be one-to-one or one-to-many
• sender and receiver have no direct knowledge of each other so promotes reuse / extension – e.g. new senders / receivers can be added without impact; senders / receivers can be replaced as required
• the broker is responsible for dealing with failures – e.g. retries, etc.
• messages may be delayed and/or arrive out of sequence

JMS.
JMS (Java Message Service) is an API from Sun which allows generic access to MOM services – in a similar way that JDBC allows generic access to databases.
Concepts.
• Provider – vendor implementation of the JMS API
• Messaging domains – two types of domain, Point To Point (PTP) or publisher/subscriber
• Message consumption – two types of consumption, synchronous and asynchronous (see below).
• Administered objects – JMS bootstrap objects (e.g. connection factories, destinations) bound in the JNDI namespace by an administrator
• ConnectionFactory – Queue/TopicConnectionFactory, used to create a connection to the Provider
• Destination – Queue/Topic, target of message production/consumption
• Connection – Queue/TopicConnection, encapsulates connection to the Provider; start () indicates that message delivery should begin
• Session – Queue/TopicSession, used to create producers, consumers and message; also provides a context for transactions
• MessageProducer – QueueSender/TopicPublisher
• MessageConsumer – QueueReceiver/TopicSubscriber; consume messages synchronously using the receive () methods or asynchronously by passing a MessageListener to setMessageListener ()
• Message – object produced or consumed; composed of header, properties and body. Body types are : text, name/value pairs, bytes, stream of primitives, serialized object or none.

PTP messaging.
• based on Queues, Senders and Receivers
• Senders and Receivers address the Queue by name
• one or more Senders but only one Receiver
• messages stay in the Queue until consumed or past expiry time
• receiver acknowledges successful processing of a message

Publisher / subscriber.
• based on Topics, Publishers and Subscribers
• Publishers and Subscribers address the Topic by name
• one or more Publishers publish to the Topic subscribed to by one or more Subscribers
• messages only stay in the Topic for as long as it takes to send them to the active Subscribers
• a subscriber can only consume “active” messages – i.e. those published since the subscriber became active (unless durable subscriptions are in use)

List Benefits of Synchronous and Asynchronous Messaging
The benefits of synchronous messaging follow:
• Because both parties must be active to participate in synchronous messaging, if either party is not active, the message transaction cannot be completed.
• A message must be acknowledged before proceeding to the next message. If it is not acknowledged, the message cannot be considered processed.

The benefits of asynchronous messaging are as follows:
• As the volume of traffic increases, asynchronous messaging is better able to handle the spike in demand by keeping a backlog of requests in its queue and then operating at maximum capacity over a period of time instead of needing to service the requests instantaneously.
• Asynchronous messaging is less affected by failures at the hardware, software, and network levels.
• When capacities are exceeded, information is not lost; instead, it is delayed.

Identify Scenarios That Are Appropriate to Implementation Using Messaging
• Scenarios appropriate to implementation using message include asynchronous communication, one-to-many communication, guaranteed messaging, and transactional messaging.

Identify Scenarios That Are More Appropriate to Implementation Using Asynchronous Messaging, Rather Than Synchronous
• You need to implement a messaging system in which a response is not required or not immediately required.
• You need a high-volume transaction processing capability for sending messages.
• You want a messaging system that uses your system hardware in an efficient manner.

Identify Scenarios that Are More Appropriate to Implementation Using Synchronous Messaging, Rather Than Asynchronous
• One scenario more appropriate to synchronous messaging includes that in which a response to the message is required before continuing, for example, for transactions requiring credit card or user login authentication.
• A second scenario includes a transaction where both parties must be active participants.

Identify Scenarios That Are Appropriate to Implementation Using Messaging, Enterprise JavaBeans Technology, or Both
• The scenarios appropriate for messaging technology include broadcasting stock prices to traders, instant messages, and in situations when integration of incompatible systems is necessary.
• The scenarios appropriate for EJB technology include those that perform business logic and those that maintain persistent data.
• The scenarios appropriate for messaging and EJB technology including those that require maintenance of distributed transactions and those that send an order to another system.

Android2.1消息应用(Messaging)源码学习笔记之二

在上一篇学习笔记中,我从整理构成应用的主要组件开始,学习了相关的源代码,基本了解了Activity、Service、Rec eiver等组件的主要 职责和任务,接下来我将对重点功能的实现方法进行深入...
  • lqrkkl
  • lqrkkl
  • 2013年01月07日 01:01
  • 1352

JBoss 7/WildFly 配置管理,开发示例,架构分析,最佳实践

JBoss 7/WildFly 配置管理,开发示例,架构分析,最佳实践
  • kylinsoong
  • kylinsoong
  • 2013年12月13日 15:45
  • 10082

Android7.0 Messaging源码分析(5) - MMS类库篇

在《Android7.0 Messaging源码分析(2) - Application 创建篇》中介绍了在 application 创建过程中会初始化MMS类库,这篇文章对 MMS 类库做简要分析。 ...
  • wenping1980
  • wenping1980
  • 2016年11月18日 14:05
  • 1456

SQL Server的升级之路系列课程(8):特定场景下的升级实战

  • 2008年04月17日 16:30
  • 4.36MB
  • 下载

Java 8新特性探究(一)通往lambda之路_语法篇

摘要 说到java 8,首先会想到lambda(闭包)以及虚拟扩展方法(default method),这个特性早已经被各大技术网站炒得沸沸扬扬了,也是我们java 8系列开篇要讲的第一特性(JE...
  • caoguanling2011
  • caoguanling2011
  • 2015年04月15日 11:05
  • 270

[HAL库学习之路]8.PWM输出

记录自己的STM32的HAL库的学习之路,不定期更新… 使用STM32CubeMx生成代码,实现PWM输出...
  • LEO_Angel01
  • LEO_Angel01
  • 2017年12月02日 10:57
  • 50

理解C语言——从小菜到大神的晋级之路(8)——数组、指针和字符串

本期视频点击这里        在前面几次我们接触的数据类型都是简单数据类型,使用一个数据个体表示一个元素。C语言中还提供了多种复杂数据类型,其中最简单的一种就是数组。数组这一结构使用内存中一段连续的...
  • shaqoneal
  • shaqoneal
  • 2016年02月06日 11:26
  • 1110

Java 8特性探究(1):通往lambda之路_语法篇

说到java 8,首先会想到lambda(闭包)以及虚拟扩展方法(default method),这个特性早已经被各大技术网站炒得沸沸扬扬了,也是我们java 8系列开篇要讲的第一特性(JEP126 ...
  • lsxf_xin
  • lsxf_xin
  • 2016年02月02日 09:59
  • 372

iOS7开发学习之路:No.8 引导页(2) 使用PageViewController

原文:http://www.appcoda.com/uipageviewcontroller-storyboard-tutorial/
  • u011156012
  • u011156012
  • 2014年07月13日 16:23
  • 12885

面试之路(8)-BAT面试题之数组和链表的区别

两种数据结构都是线性表,在排序和查找等算法中都有广泛的应用各自的特点:数组:数组是将元素在内存中连续存放,由于每个元素占用内存相同,可以通过下标迅速访问数组中任何元素。但是如果要在数组中增加一个元素,...
  • u010321471
  • u010321471
  • 2016年04月27日 22:37
  • 5377
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:SCEA之路--8. Messaging
举报原因:
原因补充:

(最多只允许输入30个字)