spring-messaging jar_Spring In My Step

spring-messaging jar_Spring In My Step概述

大家好,又见面了,我是你们的朋友全栈君。如果您正在找激活码,请点击查看最新教程,关注关注公众号 “全栈程序员社区” 获取激活教程,可能之前旧版本教程已经失效.最新Idea2022.1教程亲测有效,一键激活。

Jetbrains全家桶1年46,售后保障稳定

概述

Spring框架作为Java开源世界的集大成者,

spring-messaging模块为集成messaging api和消息协议提供支持。

在这里插入图片描述

其代码结构为:包括base、converter、core、handler、simp、support、tcp
其中base定义消息Message(MessageHeader和body)、消息处理MessageHandler、发送消息MessageChannel。

message由两部分组成,header & payload;
MessageHandler是一个处理消息的约定,spring messaging提供丰富的消息处理方式。
MessageChannel表现为pipes-and-filters架构的管道。

converter

在这里插入图片描述

public abstract class AbstractMessageConverter implements SmartMessageConverter { 
   
    @Nullable
    private ContentTypeResolver contentTypeResolver;
}

Jetbrains全家桶1年46,售后保障稳定

有消息到string、json、byte数组之间的相互转换。

core

核心模块提供消息的模板方法,

handler

HandlerMethod封装一个bean的方法相关信息(getMethod()和getBean()方法),提供访问方法参数的便利工具。HandlerMethod可以在bean factory中使用createWithResolvedBean获取bean实例时获取该实例。
MessageCondition是一个将conditions映射到message的约定。
HandlerMethodArgumentResolver 是一个解析方法参数到Context中指定Message的参数值的策略接口。
HandlerMethodReturnValueHandler是一个处理从触发一个Message的method Handling返回值的策略接口。
另外,也提供部分注解:
@interface Header:Annotation which indicates that a method parameter should be bound to a message header.
@interface Headers:Annotation which indicates that a method parameter should be bound to the headers of a message. The annotated parameter must be assignable to {@link java.util.Map} with String keys and Object values.
@interface MessageExceptionHandler: Annotation for handling exceptions thrown from message-handling methods within a specific handler class.
@interface MessageMapping:Annotation for mapping a {@link Message} onto message-handling methods by matching to the message destination.
@interface Payload:Annotation that binds a method parameter to the payload of a message. The payload may be passed through a {@link   MessageConverter} to convert it from serialized form with specific MIME type to an Object matching the target method parameter.
@interface SendTo:Annotation that indicates a method’s return value should be converted to a {@link Message} and sent to the specified destination.

rsocket

simp

包含诸如STOMP协议的简单消息协议的通用支持。

STOMP,Streaming Text Orientated Message Protocol,是流文本定向消息协议,是一种为MOM(Message Oriented Middleware,面向消息的中间件)设计的简单文本协议。它提供一个可互操作的连接格式,允许STOMP客户端与任意STOMP消息代理(Broker)进行交互,类似于OpenWire(一种二进制协议)。由于其设计简单,很容易开发客户端,因此在多种语言和多种平台上得到广泛应用。其中最流行的STOMP消息代理是Apache ActiveMQ。

在这里插入图片描述

support

提供Message的实现,及创建消息的MessageBuilder和获取消息头的MessageHeaderAccessor,还有各种不同的MessageChannel实现和channel interceptor支持。

tcp

一方面提供通过TcpOperations建立tcp connection、通过TcpConnectionHandler处理消息和通过TcpConnectionf发送消息的抽象及实现;另一方面包含对基于Reactor的tcp 消息支持。

参考

官方文档
spring-messaging模块详解

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/230740.html原文链接:https://javaforall.net

(0)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • springboot启动流程简述_请简要说明单位根的流程

    springboot启动流程简述_请简要说明单位根的流程SpringBoot启动流程简要。

    2022年8月20日
    2
  • printwriter用法_stylewriter使用教程

    printwriter用法_stylewriter使用教程OutPutStream可以被封装成PrintWriter,OutputStream比较底层一些,是以字节为单位传输的,而PrintWriter是以字符为单位输出,所以就会涉及到转码编码的问题,如果用PrintWriter发送char[]和byte[],在服务端收到的常常是有一些字符会失真.PrintWriter以字符为单位,支持汉字,OutPutStream则不行总结:处理

    2022年8月10日
    2
  • Android http Request / Response ContentType

    Android http Request / Response ContentType客户端在进行http请求服务器的时候,需要告诉服务器请求的类型,服务器在返回给客户端的数据的时候,也需要告诉客户端返回数据的类型。这个类型就是 ContentType ,不同的ContentType会影响客户端/服务器所看到的效果。contentType:告诉服务器,我要发什么类型的数据  1、默认的ContentType为 text/html也就是网页格式.   

    2022年7月19日
    9
  • MyBatis中SqlSessionFactory和SqlSession简解

    MyBatis中SqlSessionFactory和SqlSession简解1.SqlSessionFactoryBuilder这个类可以被初始、使用和丢弃,如果你已经创建好了一个SqlSessionFactory后就不用再保留它。因此,SqlSessionFactoryBuilder的最好作用域是方法体内比如说定义一个方法变量。你可以重复使用SqlSessionFactoryBuilder生成多个SqlSessionFactory实例,但是最好不要强

    2022年6月9日
    39
  • ubuntu解压命令

    ubuntu解压命令本文转自:https://www.jb51.net/article/112207.htm 本文主要介绍的是在在Ubuntu下同下各种压缩与解压的方式,压缩与解压的重要性这里就不多说,我们下面直接来看详细的介绍吧。一、.tar解包:tarxvfFileName.tar打包:tarcvfFileName.tarDirName(注:tar是打包,不是压缩!)二、.g…

    2022年5月17日
    49
  • 阿里云配置二级域名

    阿里云配置二级域名阿里云配置二级域名打开https://www.aliyun.com/?utm_content=se_1000301881打开控制台找到域名列表—解析—添加记录记录类型A-主机记录:yy.xxx.cn//—-yy二级域名xxx一级域名解析线路:默认记录值:39.xx….

    2022年5月21日
    44

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号