note of camel in action--chapter 1 introduction of relevant concepts

1 Message

    

     Headers are name-value pairs; the name is a unique, case-insensitive string, and the value is of type java.lang.Object .Headers are values associated with the message, such as sender
identifiers, hints about content encoding, authentication information, and so on.  And one point must be born in mind that Headers is the concept within Message or within one route, this is a big difference from Property.

      Attachments are typically used for the web service and email components.

      The body is of type java.lang.Object, When the sender and receiver use different body formats, Camel provides a number of mechanisms to transform the data into an acceptable format, and in  many cases the conversion happens automatically with type converters, behind the scenes.

  2  Exchange

    

 

    MEP —A pattern that denotes whether you’re using the InOnly or InOut messaging style. When the pattern is InOnly , the exchange contains an in message. For
InOut , an out message also exists that contains the reply message for the caller.

   Exception—If an error occurs at any time during routing, an Exception will be set in the exception field.
   Properties—Similar to message headers, but they last for the duration of the entire exchange. Properties are used to contain global-level (in the whole camelcontxt)information,whereas message headers are specific to a particular message(bear in mind this difference, otherwise you 'll probably be confused while learing the Sil). Camel itself will add various properties to the exchange during routing. You, as a developer, can store and retrieve properties at any point during the lifetime of an exchange.
   In message—This is the input message, which is mandatory. The in message contains the request message.
   Out message—This is an optional message that only exists if the MEP is InOut .The out message contains the reply message.

   3  Camel Architecture

 

  from the pic above , you are supposed to figure out what is an entire route in a piece of code.

  CamelContext is , to some extend , like the Application in Spring, it actually is a container

  

     besides those concepts ,there are also Producer and Consumer, Produce is usually instantiated by using ProduceTemplate

     3. 1 Producer

    When a message needs to be sent to an endpoint, the producer will create an exchange and populate it with data compatible with that particular endpoint.For example, a FileProducer will write the message body to a file. A JmsProducer , on the other hand, will map the Camel message to a javax.jms.Message before sending it to a JMS destination

     3.2 Consumer

   

    

    A consumer is the service that receives messages produced by a producer, wraps them in an exchange, and sends them to be processed. Consumers are the source of the exchanges being routed in Camel

posted @ 2019-03-13 23:40  老骥伏枥,志在千里  阅读(233)  评论(0编辑  收藏  举报