[alibaba/canal]canal使用RabbitMQ模式启动出现异常

2024-07-22 551 views
2

canal.deployer-1.1.7 版本 RabbitMQ 模式启动首先是报空指针异常,然后找到 Issue 给出的信息说没加"rabbitmq.queue = xx",加上了之后又出现新的异常:

2023-10-20 01:24:55.056 [main] ERROR com.alibaba.otter.canal.deployer.CanalLauncher - ## Something goes wrong when starting up the canal Server: java.lang.IllegalStateException: Invalid configuration: 'type' must be non-null. at com.rabbitmq.client.impl.AMQImpl$Exchange$Declare.(AMQImpl.java:1427) at com.rabbitmq.client.AMQP$Exchange$Declare$Builder.build(AMQP.java:585) at com.rabbitmq.client.impl.ChannelN.exchangeDeclare(ChannelN.java:784) at com.rabbitmq.client.impl.recovery.AutorecoveringChannel.exchangeDeclare(AutorecoveringChannel.java:237) at com.alibaba.otter.canal.connector.rabbitmq.producer.CanalRabbitMQProducer.init(CanalRabbitMQProducer.java:76) at com.alibaba.otter.canal.connector.core.spi.ProxyCanalMQProducer.init(ProxyCanalMQProducer.java:31) at com.alibaba.otter.canal.deployer.CanalStarter.start(CanalStarter.java:72) at com.alibaba.otter.canal.deployer.CanalLauncher.main(CanalLauncher.java:124)

配置是这么写的:

################################################## ######### RabbitMQ ############# ################################################## rabbitmq.host = 127.0.0.1 rabbitmq.virtual.host = / rabbitmq.exchange = canal.direct rabbitmq.username = guest rabbitmq.password = guest rabbitmq.deliveryMode = rabbitmq.queue = canal.xxx.queue

之前用的是1.1.5版本用了一年多了都没问题,现在想更新一下,我是不能理解既然配置知道了 exchange 和 routing key 就能知道队列名,为什么非要加个 rabbitmq.queue = xxx 上去

回答

3

我也是一样的错误,配置一下这个 就可以了 rabbitmq.deliveryMode =

1

问题已解决

8

canal.properties:

################################################## ######### RabbitMQ ############# ################################################## rabbitmq.host = 127.0.0.1 rabbitmq.virtual.host = / rabbitmq.exchange = canal.exchange rabbitmq.routingKey = canal.routingKey rabbitmq.queue = canal.queue rabbitmq.username = guest rabbitmq.password = guest rabbitmq.deliveryMode = direct

instance.properties:

canal.instance.filter.regex=mydb1.tb_table1,mydb1.tb_table2,mydb2.tb_table1 …… canal.mq.topic=canal.routingKey