梦想还是要有的,万一忘了咋办?

0%

Stomp

目录:

  • 概念
  • 相关
  • 示例

概念

STOMP,Streaming Text Orientated Message Protocol,是流文本定向消息协议,是一种为MOM(Message Oriented Middleware,面向消息的中间件)设计的简单文本协议。格式类似html协议

stomp格式介绍

分三部分:

  • 第一部分:command;
    帧以command字符串开始,以EOL结束,其中包括可选回车符(13字节),紧接着是换行符(10字节)。

  • 第二部分:header;
    0个或多个key:value格式的header条目, 每个条目由EOL结束。

  • 第三部分:body;
    body连接着NULL字节。本文档中的例子将使用^@,在ASCII中用control-@表示,代表NULL字节。NULL字节可以选择跟多个EOLs。欲了解更多关于STOMP帧的详细信息,请参阅Augmented BNF节本文件。

  • 本文档中引用的所有command 和header 名字都是大小写敏感的.

  • header和body中间有一个空白行(即额外EOL)。

stomp格式示例

SEND

1
2
3
4
5
6
SEND
destination:/queue/a
content-type:text/plain

hello queue a
^@

MESSAGE

1
2
3
4
5
6
7
MESSAGE
subscription:0
message-id:007
destination:/queue/a
content-type:text/plain

hello queue a^@

STOMP格式描述(BNF)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
NULL                = <US-ASCII null (octet 0)>
LF = <US-ASCII line feed (aka newline) (octet 10)>
CR = <US-ASCII carriage return (octet 13)>
EOL = [CR] LF
OCTET = <any 8-bit sequence of data>

frame-stream = 1*frame

frame = command EOL
*( header EOL )
EOL
*OCTET
NULL
*( EOL )

command = client-command | server-command

client-command = "SEND"
| "SUBSCRIBE"
| "UNSUBSCRIBE"
| "BEGIN"
| "COMMIT"
| "ABORT"
| "ACK"
| "NACK"
| "DISCONNECT"
| "CONNECT"
| "STOMP"

server-command = "CONNECTED"
| "MESSAGE"
| "RECEIPT"
| "ERROR"

header = header-name ":" header-value
header-name = 1*<any OCTET except CR or LF or ":">
header-value = *<any OCTET except CR or LF or ":">

相关

示例

参考:
STOMP协议规范

stomp协议规范-英文版本
spring-framework