Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feat]希望后续能提供一个RabbitMQ的插件 #185

Open
bwcxjason opened this issue Mar 2, 2023 · 5 comments
Open

[feat]希望后续能提供一个RabbitMQ的插件 #185

bwcxjason opened this issue Mar 2, 2023 · 5 comments
Labels
enhancement New feature or request

Comments

@bwcxjason
Copy link

bwcxjason commented Mar 2, 2023

RabbitMQ是非常流行的消息中间件,当前TIS只能支持数据库到数据库的数据同步,还不能支持到消息队列,希望后面能提供此功能。支持 AMQP协议。配置参数参考:
image

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

@欧阳奖

@baisui1981 baisui1981 added the enhancement New feature or request label Mar 2, 2023
@baisui1981
Copy link
Member

ok, 有意向来贡献该插件实现不?

@bwcxjason
Copy link
Author

ok, 有意向来贡献该插件实现不?

可以啊,我们最近一直在找个数据集成框架,还有可视化界面管理的,现在开源的基本都不行

@baisui1981
Copy link
Member

到时候,我会写一个关于何如在TIS开发插件的说明文档

@baisui1981
Copy link
Member

发送端需要 什么结构 ? 发送端 和 监听端 得保证 同一个协议才行哦

 // 发送消息
    channel.basicPublish("", QUEUE_NAME, null, message.getBytes("UTF-8"));
    System.out.println(" [x] Sent '" + message + "'");

@baisui1981 baisui1981 added this to the v3.8.0 milestone Apr 13, 2023
@baisui1981 baisui1981 changed the title 希望后续能提供一个RabbitMQ的插件 [feat]希望后续能提供一个RabbitMQ的插件 May 26, 2023
@baisui1981 baisui1981 modified the milestones: v3.8.0, v4.0.0 Aug 1, 2023
@baisui1981 baisui1981 removed the 3.8.0 label Oct 4, 2023
@baisui1981 baisui1981 removed this from the v4.0.0 milestone Oct 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants