spring-messaging jar_Spring In My Step

spring-messaging jar_Spring In My Step概述

概述

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;
}

有消息到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)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • Java文件读写

    Java文件读写1.%g用于输出科学计数法2.用printf输出换行除了’\n’,还可以用’%n’3.File类的几个构造方法:1)File(StringdirectoryPath)2)File(StringdirectoryPath,Stringfilename)3)File(FiledirObj,Stringfilename)4)File(URIuri)注意,这里的对象指的可能是一个…

    2022年7月14日
  • ASP.NET_动态网页怎么连接数据库

    ASP.NET_动态网页怎么连接数据库近期本人在关注实体设计的过程中一直在了解“ADO.NETEntityFramework数据模型”,从中结识了.NETFramework4中的ASP.NET动态数据,ASP.NET动态数据允许您通过在运行时从数据库架构推断数据实体的外观和行为并从中派生UI行为,创建可扩展的、数据驱动的Web应用程序。         动态数据的一个重要功能是基架机制

    2022年10月31日
  • 并发加锁是怎么实现的_JAVA并发编程

    并发加锁是怎么实现的_JAVA并发编程业务锁在处理并发问题时,很多情况下需要用到业务锁来达到按照某个维度同步执行业务块。例子:@Override@Transactional(rollbackFor=Exception.class,noRollbackFor=TerminateException.class)publicApplyDOsubmitApply(ApplyDOapplyDO){…

    2022年9月21日
  • 使用Pycharm运行TensorFlow,Virtualenv安装TensorFlow「建议收藏」

    使用Pycharm运行TensorFlow,Virtualenv安装TensorFlow「建议收藏」使用Pycharm运行TensorFlow,Virtualenv安装TensorFlow@(MachineLearningwithPython)系统:MacOS10.13本篇关注的是两个问题:通过virtualenv创建虚拟环境,并在此环境下安装TensorFlow在Pycharm下配置解释器,在Pycharm下运行训练代码Virtualenv+TensorflowTensorFl

    2022年8月26日
  • 图书销售管理系统需求分析,各种功能图部分

    图书销售管理系统需求分析,各种功能图部分负责人:大佬(20160402122)DEDRAGON(20160401094)完成部分:3.2有关功能图3.2.1层次图:3.2.2ipo图3.2.3e-r图3.2.4主数据流图3.2.5子功能图进货管理图库存管理图:销售管…

    2022年5月23日
  • java.lang包中不能被继承的类

    java.lang包中不能被继承的类public final class Bytepublic final class Characterpublic static final class Character.UnicodeBlockpublic final class Class<T>public final class Compiler //编译器public final class Doublepub…

    2022年6月13日

发表回复

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

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