# 一个简单Connector的实现

## 一个简单Connector的实现

下面以MySql Connector为例,如何实现一个Source Connector

首先MySql Connector要获取到连接数据库相关的配置信息，如ip，port，账号密码，同时返回TaskClass，TaskConfig信息，MySqlTask解析MySql binlog的方法通过数据变更，缓存到BlockingQueue中,Runtime通过Task poll方法拉去BlockingQueue中数据发送到RocketMQ中。

## 运行Connector流程

调用Runtime的创建Connector的RESTful接口，启动MySql Connector，启动Task。Runtime通过poll方法拉去数据发送到broker，发送成功以后会更新binlog消费进度，并且同步到集群中其他节点，所以一个节点挂掉不会影响，其他节点接管任务不会影响进度


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://rocketmq-1.gitbook.io/rocketmq-connector/gong-xian-zhe-zhi-bei/jian-dan-shi-xian.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
