首页 文章

Apache Camel Producer消费者术语dillemas

提问于
浏览
3

以下是关于Camel in Action书中给出的 生产环境 者和消费者的定义 .

The consumer could be receiving the message from an external service, polling for the message on some system, or even creating the message itself. This message then flows through a processing component, which could be an enterprise integration pattern (EIP), a processor, an interceptor, or some other custom creation. The message is finally sent to a target endpoint that’s in the role of a producer. A route may have many processing components that modify the message or send it to another location, or it may have none, in which case it would be a simple pipeline.

我的疑惑:

  • 什么是外部服务?

  • 消费者如何在 生产环境 者产生消息之前发挥作用 . 我的理解是 生产环境 者在交换中生成和转换消息,以便消息与消费者的 endpoints 兼容 .

  • 为什么消费者必须做 生产环境 者's work (that is transforming a message and sending it to producer again?) Shouldn'这是反之亦然?

谢谢!

1 回答

  • 3

    外部服务可以是,例如,外部Web服务,外部REST服务,EJB等 .

    消费者可能正在使用任何这些服务,或者它可能正在侦听要在文件系统上的特定位置创建的文件(或多个文件),它可能会从消息队列(JMS)等消耗等等 . - 只有可用的组件和 endpoints 才有无限的可能性 .

    基本上,使用apache camel,你正在设计一个消息总线(ESB),对吧?您可以这样思考 - “消费者”从外部世界获取东西并将其放在公共汽车上 .

    然后,你的消息将经历各种路线(最有可能通过EIP进行翻译和修改),然后最终它必须在现实世界中的“那里”去一些地方 - 那就是 生产环境 者做它的工作 .

    消费者对公共汽车/ 生产环境 者的消费产生了公共汽车 .

    通常,您不需要过多地考虑 endpoints 是否作为消费者作为 生产环境 者运行 - 只需根据需要使用 .from.to ,一切都应该可以正常工作 .

    也阅读了这个答案:Apache Camel producers and consumers

    我希望这有帮助!

相关问题