tis
tis copied to clipboard
[feat]希望后续能提供一个RabbitMQ的插件
RabbitMQ是非常流行的消息中间件,当前TIS只能支持数据库到数据库的数据同步,还不能支持到消息队列,希望后面能提供此功能。支持 AMQP协议。配置参数参考:
RabbitMQ的maven依赖:
<dependencies>
<dependency>
<groupId>com.rabbitmq</groupId>
<artifactId>amqp-client</artifactId>
<version>5.14.0</version>
</dependency>
</dependencies>
连接示例代码:
import com.rabbitmq.client.ConnectionFactory;
import com.rabbitmq.client.Connection;
import com.rabbitmq.client.Channel;
public class RabbitMQExample {
private final static String QUEUE_NAME = "hello";
public static void main(String[] argv) throws Exception {
// 创建连接工厂
ConnectionFactory factory = new ConnectionFactory();
factory.setHost("localhost");
factory.setUsername("guest");
factory.setPassword("guest");
// 创建连接
Connection connection = factory.newConnection();
// 创建通道
Channel channel = connection.createChannel();
// 声明队列
channel.queueDeclare(QUEUE_NAME, false, false, false, null);
String message = "Hello World!";
// 发送消息
channel.basicPublish("", QUEUE_NAME, null, message.getBytes("UTF-8"));
System.out.println(" [x] Sent '" + message + "'");
// 关闭通道和连接
channel.close();
connection.close();
}
}
数据格式要求
{
"id": "76d6d59f-5d08-41e8-a460-4ec3e03ad4d1",
"tableName": "orderinfo",
"occure_time": "1679274580528",
"event": "insert" / "update" / "delete"
"data": {
"order_id": "aabbbdddd",
"product_name": "aabbcc"
}
}
@欧阳奖
ok, 有意向来贡献该插件实现不?
ok, 有意向来贡献该插件实现不?
可以啊,我们最近一直在找个数据集成框架,还有可视化界面管理的,现在开源的基本都不行
到时候,我会写一个关于何如在TIS开发插件的说明文档
发送端需要 什么结构 ? 发送端 和 监听端 得保证 同一个协议才行哦
// 发送消息
channel.basicPublish("", QUEUE_NAME, null, message.getBytes("UTF-8"));
System.out.println(" [x] Sent '" + message + "'");
https://github.com/airbytehq/airbyte/blob/master/airbyte-integrations/connectors/destination-rabbitmq/destination_rabbitmq/spec.json