首页 > 其他分享 >canal+rabbitmq: Could not convert incoming message with content-type [null]

canal+rabbitmq: Could not convert incoming message with content-type [null]

时间:2023-05-29 16:23:10浏览次数:39  
标签:canal convert incoming java springframework rabbit RELEASE org 2.1

SpringBoot整合 Canal+RabbitMQ 实现监听 MySQL 数据库同步更新 Redis 缓存,编写RabbitMQ 消费端监听同步缓存。

接收消息是字符串返回的是字节数据,eg:

-30,-128,-100,-25,-126,-71,-27,-81,-71,-25,-126,-71,-30,-128,-99

使用了jackson的converter后,报了如下的异常:

Caused by: org.springframework.messaging.converter.MessageConversionException: No converter found from actual payload type 'byte[]' to expected payload type 'com.lynch.entity.CanalMessage'

Could not convert incoming message with content-type [null]。

 

解决办法:
重写Jackson2JsonMessageConverter的fromMessage方法,并将contentType强制为application/json。

import org.springframework.amqp.core.Message;
import org.springframework.amqp.support.converter.Jackson2JsonMessageConverter;

public class JacksonMessageConverter extends Jackson2JsonMessageConverter {
    public JacksonMessageConverter() {
        super();
    }
   
    @Override
    public Object fromMessage(Message message) {
        message.getMessageProperties().setContentType("application/json");
        return super.fromMessage(message);
    }
}

RabbitConfig类配置重新的Jackson2JsonMessageConverter类

import org.springframework.amqp.rabbit.config.SimpleRabbitListenerContainerFactory;
import org.springframework.amqp.rabbit.connection.ConnectionFactory;
import org.springframework.amqp.rabbit.listener.RabbitListenerContainerFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class RabbitConfig {
//    @Value("${spring.rabbitmq.listener.order.exchange.name}")
//    public String orderExchangeName;
 
    /**
     * 消息序列化配置
     */
    @Bean
    public RabbitListenerContainerFactory<?> rabbitListenerContainerFactory(ConnectionFactory connectionFactory) {
        SimpleRabbitListenerContainerFactory factory = new SimpleRabbitListenerContainerFactory();
        factory.setConnectionFactory(connectionFactory);
        factory.setMessageConverter(new JacksonMessageConverter());
        return factory;
    }
    
 
}

消息异常:

2023-05-29 15:39:01.957  WARN 10204 --- [ntContainer#0-4] s.a.r.l.ConditionalRejectingErrorHandler : Execution of Rabbit message listener failed.

org.springframework.amqp.rabbit.listener.exception.ListenerExecutionFailedException: Listener method could not be invoked with the incoming message
Endpoint handler details:
Method [public void com.lynch.rabbitmq.springboot.CanalListener.onMessage(org.springframework.messaging.Message<com.lynch.entity.CanalMessage>,com.rabbitmq.client.Channel) throws java.lang.Exception]
Bean [com.lynch.rabbitmq.springboot.CanalListener@63fa752b]
    at org.springframework.amqp.rabbit.listener.adapter.MessagingMessageListenerAdapter.invokeHandler(MessagingMessageListenerAdapter.java:199) ~[spring-rabbit-2.1.8.RELEASE.jar:2.1.8.RELEASE]
    at org.springframework.amqp.rabbit.listener.adapter.MessagingMessageListenerAdapter.onMessage(MessagingMessageListenerAdapter.java:129) ~[spring-rabbit-2.1.8.RELEASE.jar:2.1.8.RELEASE]
    at org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.doInvokeListener(AbstractMessageListenerContainer.java:1542) ~[spring-rabbit-2.1.8.RELEASE.jar:2.1.8.RELEASE]
    at org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.actualInvokeListener(AbstractMessageListenerContainer.java:1468) ~[spring-rabbit-2.1.8.RELEASE.jar:2.1.8.RELEASE]
    at org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.invokeListener(AbstractMessageListenerContainer.java:1456) ~[spring-rabbit-2.1.8.RELEASE.jar:2.1.8.RELEASE]
    at org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.doExecuteListener(AbstractMessageListenerContainer.java:1451) ~[spring-rabbit-2.1.8.RELEASE.jar:2.1.8.RELEASE]
    at org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.executeListener(AbstractMessageListenerContainer.java:1400) ~[spring-rabbit-2.1.8.RELEASE.jar:2.1.8.RELEASE]
    at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.doReceiveAndExecute(SimpleMessageListenerContainer.java:870) [spring-rabbit-2.1.8.RELEASE.jar:2.1.8.RELEASE]
    at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.receiveAndExecute(SimpleMessageListenerContainer.java:854) [spring-rabbit-2.1.8.RELEASE.jar:2.1.8.RELEASE]
    at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.access$1600(SimpleMessageListenerContainer.java:78) [spring-rabbit-2.1.8.RELEASE.jar:2.1.8.RELEASE]
    at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer$AsyncMessageProcessingConsumer.mainLoop(SimpleMessageListenerContainer.java:1137) [spring-rabbit-2.1.8.RELEASE.jar:2.1.8.RELEASE]
    at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer$AsyncMessageProcessingConsumer.run(SimpleMessageListenerContainer.java:1043) [spring-rabbit-2.1.8.RELEASE.jar:2.1.8.RELEASE]
    at java.lang.Thread.run(Thread.java:748) [na:1.8.0_201]
Caused by: org.springframework.messaging.converter.MessageConversionException: No converter found from actual payload type 'byte[]' to expected payload type 'com.lynch.entity.CanalMessage'
    at org.springframework.messaging.handler.annotation.support.MessageMethodArgumentResolver.convertPayload(MessageMethodArgumentResolver.java:135) ~[spring-messaging-5.1.9.RELEASE.jar:5.1.9.RELEASE]
    at org.springframework.messaging.handler.annotation.support.MessageMethodArgumentResolver.resolveArgument(MessageMethodArgumentResolver.java:93) ~[spring-messaging-5.1.9.RELEASE.jar:5.1.9.RELEASE]
    at org.springframework.messaging.handler.invocation.HandlerMethodArgumentResolverComposite.resolveArgument(HandlerMethodArgumentResolverComposite.java:117) ~[spring-messaging-5.1.9.RELEASE.jar:5.1.9.RELEASE]
    at org.springframework.messaging.handler.invocation.InvocableHandlerMethod.getMethodArgumentValues(InvocableHandlerMethod.java:148) ~[spring-messaging-5.1.9.RELEASE.jar:5.1.9.RELEASE]
    at org.springframework.messaging.handler.invocation.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:116) ~[spring-messaging-5.1.9.RELEASE.jar:5.1.9.RELEASE]
    at org.springframework.amqp.rabbit.listener.adapter.HandlerAdapter.invoke(HandlerAdapter.java:50) ~[spring-rabbit-2.1.8.RELEASE.jar:2.1.8.RELEASE]
    at org.springframework.amqp.rabbit.listener.adapter.MessagingMessageListenerAdapter.invokeHandler(MessagingMessageListenerAdapter.java:196) ~[spring-rabbit-2.1.8.RELEASE.jar:2.1.8.RELEASE]
    ... 12 common frames omitted

2023-05-29 15:39:01.957  WARN 10204 --- [ntContainer#0-2] ingErrorHandler$DefaultExceptionStrategy : Fatal message conversion error; message rejected; it will be dropped or routed to a dead letter exchange, if so configured: (Body:'[B@722320c8(byte[1333])' MessageProperties [headers={}, contentLength=0, redelivered=false, receivedExchange=canal.exchange, receivedRoutingKey=canal.routing.key, deliveryTag=6, consumerTag=amq.ctag-sd6w4IXfXBOIvvBpGxcsBA, consumerQueue=canal.queue])
2023-05-29 15:39:01.958  WARN 10204 --- [ntContainer#0-4] ingErrorHandler$DefaultExceptionStrategy : Fatal message conversion error; message rejected; it will be dropped or routed to a dead letter exchange, if so configured: (Body:'[B@79287307(byte[1330])' MessageProperties [headers={}, contentLength=0, redelivered=false, receivedExchange=canal.exchange, receivedRoutingKey=canal.routing.key, deliveryTag=57, consumerTag=amq.ctag-CyFlV748Nc7FHyq3Rz7M6w, consumerQueue=canal.queue])
2023-05-29 15:39:01.958 ERROR 10204 --- [ntContainer#0-4] o.s.a.r.l.SimpleMessageListenerContainer : Execution of Rabbit message listener failed, and the error handler threw an exception

org.springframework.amqp.AmqpRejectAndDontRequeueException: Error Handler converted exception to fatal
    at org.springframework.amqp.rabbit.listener.ConditionalRejectingErrorHandler.handleError(ConditionalRejectingErrorHandler.java:105) ~[spring-rabbit-2.1.8.RELEASE.jar:2.1.8.RELEASE]
    at org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.invokeErrorHandler(AbstractMessageListenerContainer.java:1368) [spring-rabbit-2.1.8.RELEASE.jar:2.1.8.RELEASE]
    at org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.handleListenerException(AbstractMessageListenerContainer.java:1621) [spring-rabbit-2.1.8.RELEASE.jar:2.1.8.RELEASE]
    at org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.executeListener(AbstractMessageListenerContainer.java:1414) [spring-rabbit-2.1.8.RELEASE.jar:2.1.8.RELEASE]
    at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.doReceiveAndExecute(SimpleMessageListenerContainer.java:870) [spring-rabbit-2.1.8.RELEASE.jar:2.1.8.RELEASE]
    at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.receiveAndExecute(SimpleMessageListenerContainer.java:854) [spring-rabbit-2.1.8.RELEASE.jar:2.1.8.RELEASE]
    at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.access$1600(SimpleMessageListenerContainer.java:78) [spring-rabbit-2.1.8.RELEASE.jar:2.1.8.RELEASE]
    at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer$AsyncMessageProcessingConsumer.mainLoop(SimpleMessageListenerContainer.java:1137) [spring-rabbit-2.1.8.RELEASE.jar:2.1.8.RELEASE]
    at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer$AsyncMessageProcessingConsumer.run(SimpleMessageListenerContainer.java:1043) [spring-rabbit-2.1.8.RELEASE.jar:2.1.8.RELEASE]
    at java.lang.Thread.run(Thread.java:748) [na:1.8.0_201]
Caused by: org.springframework.amqp.rabbit.listener.exception.ListenerExecutionFailedException: Listener method could not be invoked with the incoming message
Endpoint handler details:
Method [public void com.lynch.rabbitmq.springboot.CanalListener.onMessage(org.springframework.messaging.Message<com.lynch.entity.CanalMessage>,com.rabbitmq.client.Channel) throws java.lang.Exception]
Bean [com.lynch.rabbitmq.springboot.CanalListener@63fa752b]
    at org.springframework.amqp.rabbit.listener.adapter.MessagingMessageListenerAdapter.invokeHandler(MessagingMessageListenerAdapter.java:199) ~[spring-rabbit-2.1.8.RELEASE.jar:2.1.8.RELEASE]
    at org.springframework.amqp.rabbit.listener.adapter.MessagingMessageListenerAdapter.onMessage(MessagingMessageListenerAdapter.java:129) ~[spring-rabbit-2.1.8.RELEASE.jar:2.1.8.RELEASE]
    at org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.doInvokeListener(AbstractMessageListenerContainer.java:1542) [spring-rabbit-2.1.8.RELEASE.jar:2.1.8.RELEASE]
    at org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.actualInvokeListener(AbstractMessageListenerContainer.java:1468) [spring-rabbit-2.1.8.RELEASE.jar:2.1.8.RELEASE]
    at org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.invokeListener(AbstractMessageListenerContainer.java:1456) [spring-rabbit-2.1.8.RELEASE.jar:2.1.8.RELEASE]
    at org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.doExecuteListener(AbstractMessageListenerContainer.java:1451) [spring-rabbit-2.1.8.RELEASE.jar:2.1.8.RELEASE]
    at org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.executeListener(AbstractMessageListenerContainer.java:1400) [spring-rabbit-2.1.8.RELEASE.jar:2.1.8.RELEASE]
    ... 6 common frames omitted
Caused by: org.springframework.messaging.converter.MessageConversionException: No converter found from actual payload type 'byte[]' to expected payload type 'com.lynch.entity.CanalMessage'
    at org.springframework.messaging.handler.annotation.support.MessageMethodArgumentResolver.convertPayload(MessageMethodArgumentResolver.java:135) ~[spring-messaging-5.1.9.RELEASE.jar:5.1.9.RELEASE]
    at org.springframework.messaging.handler.annotation.support.MessageMethodArgumentResolver.resolveArgument(MessageMethodArgumentResolver.java:93) ~[spring-messaging-5.1.9.RELEASE.jar:5.1.9.RELEASE]
    at org.springframework.messaging.handler.invocation.HandlerMethodArgumentResolverComposite.resolveArgument(HandlerMethodArgumentResolverComposite.java:117) ~[spring-messaging-5.1.9.RELEASE.jar:5.1.9.RELEASE]
    at org.springframework.messaging.handler.invocation.InvocableHandlerMethod.getMethodArgumentValues(InvocableHandlerMethod.java:148) ~[spring-messaging-5.1.9.RELEASE.jar:5.1.9.RELEASE]
    at org.springframework.messaging.handler.invocation.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:116) ~[spring-messaging-5.1.9.RELEASE.jar:5.1.9.RELEASE]
    at org.springframework.amqp.rabbit.listener.adapter.HandlerAdapter.invoke(HandlerAdapter.java:50) ~[spring-rabbit-2.1.8.RELEASE.jar:2.1.8.RELEASE]
    at org.springframework.amqp.rabbit.listener.adapter.MessagingMessageListenerAdapter.invokeHandler(MessagingMessageListenerAdapter.java:196) ~[spring-rabbit-2.1.8.RELEASE.jar:2.1.8.RELEASE]
    ... 12 common frames omitted

2023-05-29 15:39:01.958 ERROR 10204 --- [ntContainer#0-2] o.s.a.r.l.SimpleMessageListenerContainer : Execution of Rabbit message listener failed, and the error handler threw an exception

org.springframework.amqp.AmqpRejectAndDontRequeueException: Error Handler converted exception to fatal
    at org.springframework.amqp.rabbit.listener.ConditionalRejectingErrorHandler.handleError(ConditionalRejectingErrorHandler.java:105) ~[spring-rabbit-2.1.8.RELEASE.jar:2.1.8.RELEASE]
    at org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.invokeErrorHandler(AbstractMessageListenerContainer.java:1368) [spring-rabbit-2.1.8.RELEASE.jar:2.1.8.RELEASE]
    at org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.handleListenerException(AbstractMessageListenerContainer.java:1621) [spring-rabbit-2.1.8.RELEASE.jar:2.1.8.RELEASE]
    at org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.executeListener(AbstractMessageListenerContainer.java:1414) [spring-rabbit-2.1.8.RELEASE.jar:2.1.8.RELEASE]
    at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.doReceiveAndExecute(SimpleMessageListenerContainer.java:870) [spring-rabbit-2.1.8.RELEASE.jar:2.1.8.RELEASE]
    at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.receiveAndExecute(SimpleMessageListenerContainer.java:854) [spring-rabbit-2.1.8.RELEASE.jar:2.1.8.RELEASE]
    at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.access$1600(SimpleMessageListenerContainer.java:78) [spring-rabbit-2.1.8.RELEASE.jar:2.1.8.RELEASE]
    at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer$AsyncMessageProcessingConsumer.mainLoop(SimpleMessageListenerContainer.java:1137) [spring-rabbit-2.1.8.RELEASE.jar:2.1.8.RELEASE]
    at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer$AsyncMessageProcessingConsumer.run(SimpleMessageListenerContainer.java:1043) [spring-rabbit-2.1.8.RELEASE.jar:2.1.8.RELEASE]
    at java.lang.Thread.run(Thread.java:748) [na:1.8.0_201]
Caused by: org.springframework.amqp.rabbit.listener.exception.ListenerExecutionFailedException: Listener method could not be invoked with the incoming message
Endpoint handler details:
Method [public void com.lynch.rabbitmq.springboot.CanalListener.onMessage(org.springframework.messaging.Message<com.lynch.entity.CanalMessage>,com.rabbitmq.client.Channel) throws java.lang.Exception]
Bean [com.lynch.rabbitmq.springboot.CanalListener@63fa752b]
    at org.springframework.amqp.rabbit.listener.adapter.MessagingMessageListenerAdapter.invokeHandler(MessagingMessageListenerAdapter.java:199) ~[spring-rabbit-2.1.8.RELEASE.jar:2.1.8.RELEASE]
    at org.springframework.amqp.rabbit.listener.adapter.MessagingMessageListenerAdapter.onMessage(MessagingMessageListenerAdapter.java:129) ~[spring-rabbit-2.1.8.RELEASE.jar:2.1.8.RELEASE]
    at org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.doInvokeListener(AbstractMessageListenerContainer.java:1542) [spring-rabbit-2.1.8.RELEASE.jar:2.1.8.RELEASE]
    at org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.actualInvokeListener(AbstractMessageListenerContainer.java:1468) [spring-rabbit-2.1.8.RELEASE.jar:2.1.8.RELEASE]
    at org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.invokeListener(AbstractMessageListenerContainer.java:1456) [spring-rabbit-2.1.8.RELEASE.jar:2.1.8.RELEASE]
    at org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.doExecuteListener(AbstractMessageListenerContainer.java:1451) [spring-rabbit-2.1.8.RELEASE.jar:2.1.8.RELEASE]
    at org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.executeListener(AbstractMessageListenerContainer.java:1400) [spring-rabbit-2.1.8.RELEASE.jar:2.1.8.RELEASE]
    ... 6 common frames omitted
Caused by: org.springframework.messaging.converter.MessageConversionException: No converter found from actual payload type 'byte[]' to expected payload type 'com.lynch.entity.CanalMessage'
    at org.springframework.messaging.handler.annotation.support.MessageMethodArgumentResolver.convertPayload(MessageMethodArgumentResolver.java:135) ~[spring-messaging-5.1.9.RELEASE.jar:5.1.9.RELEASE]
    at org.springframework.messaging.handler.annotation.support.MessageMethodArgumentResolver.resolveArgument(MessageMethodArgumentResolver.java:93) ~[spring-messaging-5.1.9.RELEASE.jar:5.1.9.RELEASE]
    at org.springframework.messaging.handler.invocation.HandlerMethodArgumentResolverComposite.resolveArgument(HandlerMethodArgumentResolverComposite.java:117) ~[spring-messaging-5.1.9.RELEASE.jar:5.1.9.RELEASE]
    at org.springframework.messaging.handler.invocation.InvocableHandlerMethod.getMethodArgumentValues(InvocableHandlerMethod.java:148) ~[spring-messaging-5.1.9.RELEASE.jar:5.1.9.RELEASE]
    at org.springframework.messaging.handler.invocation.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:116) ~[spring-messaging-5.1.9.RELEASE.jar:5.1.9.RELEASE]
    at org.springframework.amqp.rabbit.listener.adapter.HandlerAdapter.invoke(HandlerAdapter.java:50) ~[spring-rabbit-2.1.8.RELEASE.jar:2.1.8.RELEASE]
    at org.springframework.amqp.rabbit.listener.adapter.MessagingMessageListenerAdapter.invokeHandler(MessagingMessageListenerAdapter.java:196) ~[spring-rabbit-2.1.8.RELEASE.jar:2.1.8.RELEASE]
    ... 12 common frames omitted

2023-05-29 15:39:12.866  WARN 10204 --- [ntContainer#0-1] s.a.r.l.ConditionalRejectingErrorHandler : Execution of Rabbit message listener failed.

 

标签:canal,convert,incoming,java,springframework,rabbit,RELEASE,org,2.1
From: https://www.cnblogs.com/linjiqin/p/17440734.html

相关文章

  • Java:SpringBoot整合Canal+RabbitMQ组合实现MySQL数据监听
    canal[kə’næl],译意为水道/管道/沟渠,主要用途是基于MySQL数据库增量日志解析,提供增量数据订阅和消费目录一、MySQL设置二、启动Canal服务端三、通过Canal客户端消费数据四、通过RabbitMQ消费数据1、启动RabbitMQ2、修改canal配置3、消费RabbitMQ中的数据文档资料github:https......
  • Canal 安装 && 使用,监听Mysql数据库
    1.下载canal.deployer-1.1.5.tar.gz2.查看数据库是否开启binlog模式(必须)showvariableslike'log_%';log_bin属性值为ON,则binlog模式开启;为OFF则binlog模式关闭。若binlog模式关闭,则在MySQL配置文件my.cnf(my.ini)设置如下信息:[mysqld]log-bin=mysql-bin#开启binlogbi......
  • Jmeter函数助手29-dateTimeConvert
    dateTimeConvert函数用于将源格式进行目标格式的转换。格式化时间:传入时间参数,此处格式需要与源时间格式一致源时间格式:传入参数的时间格式目标时间格式:想要转换成的格式 1、将源格式转换成目标格式,注意传入的时间需要与源格式一致。${__dateTimeConvert(${lastday},YYYY......
  • 538. Convert BST to Greater Tree刷题笔记
    问题描述第一次没做出来,主要问题还是出在递归上pycharm代码classNode(object):def__init__(self,x):self.val=xself.left=Noneself.right=None#树生成代码defgenerate_tree(vals):iflen(vals)==0:returnNone......
  • HttpMessageConverter<T>的了解
    消息转换器的具体工作机制示意图 SpringMVC处理json底层就是依靠HttpMessageConverter来实现的。前台发来一个请求报文,根据请求报文的类型来选择一个实现了HttpinputMessage的接口的类来封装信息,然后根据请求头的Accept属性来选择对应的实现了HttpMessageConverter的接口的类......
  • 使用canal同步mysql数据到elasticsearch
    官方去下载canal包https://github.com/alibaba/canal/releases/tag/canal-1.1.6分为deployer、admin、adapter三个模块。deployer是数据库数据同步服务端。adapter是适配同步到不同终端,可以是es,hbase,redis其它数据库等。admin是一个配置管理中心,但是吧又没有配置adapter的界面,a......
  • C#中BitConverter.ToUInt16、BitConverter.ToUInt32原理与用法详解
    一、基础知识a、1字节=8位(1Byte=8bit) 二进制表示:11111111 十进制表示:255计算机内部约定用多少字节来规范数值,比如红绿蓝三色在计算机中只分配了一个字节,一个字节有八位,每一位只能储存1或0,计算机只认识二进制(0与1),所以就是2的八次方,计算机中约定从0开始计数,所......
  • .Net 5 CanalSharp Mysql CDC (增量同步,捕获变更数据)Docker 系列之 Canal (CDC 增量
    CanalSharp阿里云的解决方案,需要两部分Canal 服务端要和Mysql连在一起(目前我是用docker部署的服务)另外一部分就是CanalSharp单独的客户端服务(.Net5服务)CanalSharp文档可以参考:https://canalsharp.azurewebsites.net/zh/安装服务,可以点击下边的连接。Docker系列之Canal......
  • .NET 6 Mysql Canal (CDC 增量同步,捕获变更数据) 案例版
    之前业务需要捕捉到业务数据增量部分,并对其进行宽表处理,这也是其中的一个技术方案,方案主要是用了CDC的技术。CDC全称是ChangeDataCapture,捕获变更数据,是一个比较广泛的概念,只要是能够捕获所有数据的变化,比如数据库捕获完整的变更日志记录增、删、改等,都可以称为CDC。该功能被......
  • Newtonsoft.JSON 自定义JsonConverter
    引用:https://www.cjavapy.com/article/2513/https://www.cnblogs.com/weihanli/p/11080531.htmlhttps://www.cnblogs.com/Lulus/p/16968656.htmlhttps://www.cjavapy.com/article/2513/https://www.cnblogs.com/net-sky/p/16563025.htmlpublicclassDecimalConver......