Camel概念【Message】

原创
2015/01/27 17:19
阅读数 213

此为message的功能

Messages are the entities used by systems to communicate with each other when using

messaging channels. (message是系统在信道间通信的实体)

Messages flow in one direction from a sender to a receiver, as illustrated in figure 1.3.

此为message的结构

Messages have a body (a payload),headers, and optional attachments, as illustrated in figure 1.4.


 

此为message的特点

1)Messages are uniquely identified with an identifier of type java.lang.String

2)The identifier’s uniqueness is enforced and guaranteed by the message creator, 

3)It’s protocol dependent, and it doesn’t have a guaranteed format.

4) For protocols that don’t define a unique message identification scheme, Camel uses its own  UID generator.

HEADERS AND ATTACHMENTS


Headers are values associated with the message, such as sender identifiers, hints about content encoding,authentication information, and so on. (header与Message相关联的值有:发送者的标识符、内容编码提示、认证信息等)

Headers are name-value pairs; the name is a unique, case-insensitive string, and the value is of type  java.lang.Object .(headers 是键值对的组合,键(name)是不区分大小写的唯一字串,值(value)是java对象)

 This means that Camel imposes no constraints on the type of the headers. (header的类型是没有限制的)

Headers are stored as a map within the message.(header作为map存储)

 A message can also have optional attachments(附件), which are typically used for the web service and email components.


BODY

The body is of type  java.lang.Object . That means that a message can store any kind of content. (body也是一种java对象,这意味着message可以以任何形式储存)

It also means that it’s up to the application designer to make sure that the receiver can understand the content of the message. When the sender and receiveruse different body formats, Camel provides a number of mechanisms to transform the data into an acceptable format, and in many cases the conversion happens automati-cally with type converters, behind the scenes.(这也意味着,应用设计者要确保当传送方以不同格式传送message时,接收方可以理解message的内容,camel给出了很多传输转换机制确保数据是可接受的格式,在很多条件下,转换机制将在框架内部实现自动转换)

FAULT FLAG

Messages also have a fault flag. Some protocols and specifications, such as  WSDL and

JBI , distinguish between output and fault messages. They’re both valid responses to

invoking an operation, but the latter indicates an unsuccessful outcome. In general,

faults aren’t handled by the integration infrastructure. They’re part of the contract

between the client and the server and are handled at the application level.(注意错误的级别)

During routing, messages are contained in an exchange.(messages 包含在Exchange当中)


展开阅读全文
打赏
0
1 收藏
分享
加载中
更多评论
打赏
0 评论
1 收藏
0
分享
返回顶部
顶部