Apache的骆驼生产者和消费者 [英] Apache Camel producers and consumers

查看:222
本文介绍了Apache的骆驼生产者和消费者的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有包装我的头周围的概念困难。

I have difficulties wrapping my head around the concept.

我想实现一个TCP端口,用于专有格式传入的消息,然后将转换消息,并有骆驼接管转发和路由上侦听的端点。

I am trying to implement an endpoint that listens on a tcp port for incoming messages in a proprietary format, which would then transform the message and have camel take over the forwarding and routing.

难道我理解正确的是生产者负责发送邮件到端点消费者接收它们从端点?

Did I understand correctly that that the Producer is responsible for sending messages into the Endpoint and the Consumer receives them from that endpoint?

在学习界面我无法弄清楚这些对象之间的信息流动,特别是对消费者的一部分。 消费者只定义了开始()停止()方法...

When studying the interfaces I couldn't figure out the message flow between those objects, especially on the consumer part. Consumer only defines start() and stop() methods...

当一个框架实现,骆驼调用 createProducer()在端点上并设置测试进程()制片对象。之后,它返回swithout做与消费者或与之相关联的处理器的任何

When setting up a test on a skeleton implementation, Camel invoked createProducer() on the endpoint and process() on the producer object. After that it returned, swithout doing anything with the consumer or the processor associated with it.

有人能指出我在正确的方向?

Could someone point me in the right direction?

推荐答案

我终于想通了通过看流组件。

I finally figured it out by looking at the Stream component.

原来,我做了思考端点作为中心的东西直通其一切都必须去的错误。

Turns out that I made the mistake of thinking about the endpoint as something central thru which everything must go.

简单的答案是,消费者从外部系统(监听我的情况的服务器套接字)接收数据和生产者将数据发送到外部系统。

The simple answer is that the consumer receives data from an external system (listening on a server socket in my case) and the producer sends data to the external system.

由于我的终点是只读的(它不会被用作骆驼路由进程的最终目的地),我真的不需要一个生产者(应该抛出RuntimeException如果系统仍试图做到这一点,由于配置错误)。一个恰当的例子是骆驼原子端点 - 你可以阅读饲料,但(为1.6.0),你不能发布一个

Since my endpoint is read-only (it will not be used as the final destination of Camel routing process), I really do not need a producer (it should throw a RuntimeException if the system still tries to do it due to misconfiguration). A fitting example would be the camel-atom endpoint - you can read feeds but (as of 1.6.0) you cannot publish one.

同样的,你只需要一个制片人不从外部系统(例如日志)接收数据的只写端点。

Likewise, you only need a producer for a write-only endpoint which does not receive data from an external system (e.g logging).

这篇关于Apache的骆驼生产者和消费者的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆