camel 模仿了spring的jdbctemplate和jmstemplate,使用ProducerTemplate和ConsumerTemplate来模拟发送消息和接受消息。
来来来,先来看ProducerTemplate,
比如:
producerTemplate.sendBody("activemq:quotes", "Camel Rocks");
就可以发送一个textMessage给activemq上的名为quotes的队列。producerTemplate里包含了一系列sendXX方法和requestXX方法。send开头的方法发出去不求任何回应,而request系列等待回应
这个request有点像Http里面的概念。
Method MEP Description
sendBody InOnly Sends a message payload to a destination.
sendBodyAndHeader InOnly Sends a message payload and a header to a destination.
sendBodyAndHeaders InOnly