在Camel @Produce中产生了什么,而@Consume消耗了什么?

时间:2017-07-11 18:21:12

标签: java apache-camel enterprise-integration

作为一个无关紧要的拙见,我发现apache camel docs太过冒昧,因为假设读者已经有了骆驼的背景。

通常情况下,Web服务提供商是生产者,其生产的服务的客户是消费者。

让我们看一下http://camel.apache.org/pojo-producing.html

其中说,有两种不同的方法可以向Camel Endpoint发送消息。

@EndpointInjecct (uri ..) ProducerTemplate ...

是说

  • 嘿我;是一个端点,这是我的uri和模板打我,所以打我

  • 或者,嗯......在清澈湛蓝的天空下,某个地方有一个这个uri的终点,这就是我认为我会用

  • 命中它的模板

???

同样,是@Produce和ProducerTemplate

  • 指定我是一个会被击中的终点?
  • 或指定我要打的制作人的模板??

同样,@ Consume,

  • 我是否指定我是消费者?
  • 或者说我要说明我的饮食方式?

BTW,@ Produce(uri)或EndpointInjection(uri)中的uri

  • 我发送给这个uri?
  • 或在此uri下接受?

1 个答案:

答案 0 :(得分:0)

As per your doubts, below I'm trying to clarify:

@EndpointInject (uri=...) ProducerTemplate ...

This means rather your 2nd option:

there is an endpoint with this uri somewhere out there beneath the clear blue skies, and here is the template I presume I'm gonna hit it with

I.e., uses the Camel API, ProducerTemplate, to send the message to another endpoint, defined on the uri.

Regarding the @Produce and ProducerTemplate, the closest guess here would be

specifying the template of a producer I am going to hit

Although technically the endpoint specified to be hit on the uri is not to be mistaken with the producer in Camel terminology, it is simply an endpoint, which in this context would be called a consumer since it receives messages.

Analogously, regarding @Consume marks the method as a consumer method, i.e. the one that handles the endpoint incomming messages, endpoint specified by the uri.

Hope this is of some help.