`
honno
  • 浏览: 56695 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

企业集成模式与Mule--接收表模式

    博客分类:
  • Mule
阅读更多

Gregor Hohpe在《Enterprise Integration Patterns 》一书中讲述了几十种企业集成模式 (Enterprise Integration Pattern,EIP )。
目前企业集成模式 一共有65种。

本文介绍其中的一种接收表模式(Recipient List)。

1.读者要求 :了解企业集成模式,了解Mule.

2.接收表模式 :将消息分发到多个通道中,消息消费者通过这些通道接收消息。

3.使用场景 :在使用邮件的过程中,我们可以将一封邮件分发给多个邮件地址,这就是接收表模式的一个简单应用,在这里邮件相当于
消息,邮件地址相当于通道,消息消费者相当于邮箱的使用者。

4.接收表模式在Mule中的实现
StaticRecipientList 简单地实现了一个静态的接收表模式,静态是指在配置文件中指定消息的通道。
下面是其主要方法的代码片段:
....
//从message的熟悉中获得recipients
List recipients = this.getRecipients(message);
//将消息发送到每个recipient上。
for (Iterator iterator = recipients.iterator(); iterator.hasNext;){
     Object recipient = iterator.next();
      request = new DefaultMuleMessage(message.getPayload(), message);
      endpoint = this.getRecipientEndpoint(request, recipient);
      try {
            //将消息发送或者分发到每个端点上,消息接受者可以在端点上接收消息。
      if (synchronous) {
                    result = this.send(session, request, endpoint);
                    if (result != null) {
                           results.add(result.getPayload());
                   }
            }else {
             this.dispatch(session, request, endpoint);
        }
             } catch (MuleException e) {
                        throw new CouldNotRouteOutboundMessageException(request,endpoint, e);
              }
     }
.....

5.在Mule中使用静态接收表模式

<static-recipient-list-router >
                    <recipients>
                        <spring:value>vm://recipient1</spring:value>
                        <spring:value>vm://recipient2</spring:value>
                        <spring:value>vm://recipient3</spring:value>
                    </recipients>
</static-recipient-list-router>
         上述的配置文件中,我们给static-recipient-list-router设定了3个recipient,分别是vm://recipient1,vm://recipient2和vm://recipient3。
Mule会将消息分发给这3个recipient,我们可以在这3个recipient上接收相同的消息。

分享到:
评论

相关推荐

    mule-standalone-3.9.0.zip

    总之,"mule-standalone-3.9.0.zip"是Mule ESB的独立运行时环境,它为企业提供了一种高效、灵活的集成解决方案。通过理解和利用其特性,开发者可以构建出健壮的、可扩展的集成系统,连接并协调企业的各个部分。

    mule-standalone-3.5.0.tar.gz

    总的来说,"mule-standalone-3.5.0.tar.gz" 是一个强大的集成平台,提供了一套完整的工具集,使开发者能够高效地构建和管理企业级集成解决方案。通过解压这个压缩包,你可以得到完整的Mule ESB运行环境,包括所有...

    mule-standalone-3.5.0

    标题“mule-standalone-3.5.0”指的是Mule ESB的特定版本——3.5.0独立版。在这个版本中,Mule ESB被设计为一个单独运行的服务器,无需依赖其他应用服务器,从而提供了更高的部署灵活性和更快的启动时间。独立版本...

    mule的最新版本mule-standalone-3.1.1

    mule的最新版本mule-standalone-3.1.1

    maven-mule-plugin-1.8.jar

    maven-mule-plugin-1.8.jar

    mule-1.4.4-getting-started.pdf

    mule-1.4.4开发指南 mule esb开发指南

    maven-mule-plugin-1.2.jar

    maven-mule-plugin-1.2.jar

    mule-transport-quartz-3.5.0-M4.zip

    标题 "mule-transport-quartz-3.5.0-M4.zip" 提供的信息表明,这是一个与Mule ESB(企业服务总线)相关的组件,具体是Quartz定时任务运输器的一个版本。Mule ESB是一款流行的开源集成平台,用于构建和运行连接应用...

    mule-standalone-3.9.0-hf2.tar.gz

    mule esb 3.9.0 运行环境

    mule-standalone-3.2.0.zip

    在这个特定的版本——"mule-standalone-3.2.0.zip"中,我们将会深入探讨这个独立服务器的特性、优势以及如何部署和使用。 首先,"standalone"意味着这个版本是自包含的,不需要额外的服务器环境如JBOSS或Tomcat,...

    mule-2.2.1-users-guide

    mule 2.2.1 users guide

    mule-module-client-2.2.1.rar_mule

    mule-module-client mule-module-client

    mule-standalone-3.6.0.zip

    **三、Mule ESB社区版与企业版的区别** Mule ESB社区版是免费的,适用于开发和测试环境,提供了基本的集成功能。而企业版则提供了更多高级功能,如安全控制、性能监控、高级错误处理和专门的技术支持。 **四、Mule...

    mule -esb 源码

    `mule-spring-configuration.dtd`和`mule-configuration.dtd`是Mule ESB的XML配置文件的DTD(文档类型定义),它们规定了XML配置文件的结构和元素。Spring是Mule ESB的核心组件之一,负责管理对象的生命周期和依赖...

    mule-spring-boot-starter

    使用mule-spring-boot-starter,您可以运行Spring Boot应用程序中嵌入的Mule CE。 这使Mule开发人员无需下载Mule运行时,创建Maven工件并将工件推送到Mule运行时即可快速原型化和/或部署Mule应用程序。 该项目将...

    mule-3.8.1-embedded.jar

    mule-3.8.1-embedded.jar

    mule_examples.rar_mule_mule 开发_mule-2.2.1-src

    mule的一些例子注意需要mule-2.0.1的包

    mule-standalone-4.2.0.zip

    1.mule-standalone-4.2.0的zip包 2.开发可以使用AnypointStudio内置的standalone,独立部署需要单独的standalone 3.开发时候的版本要与部署的standalone版本一致,否则可能部署失败

    maven-mule-plugin-1.6-sources.jar

    maven-mule-plugin-1.6-sources.jar

Global site tag (gtag.js) - Google Analytics