-
Notifications
You must be signed in to change notification settings - Fork 822
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
121 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
springboot-prometheus-canal/src/main/java/com/pancm/dao/CanalRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package com.pancm.dao; | ||
|
||
import com.pancm.domain.CanalDO; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
import org.springframework.stereotype.Repository; | ||
|
||
@Repository | ||
public interface CanalRepository extends JpaRepository<CanalDO, Long> { | ||
} |
36 changes: 36 additions & 0 deletions
36
springboot-prometheus-canal/src/main/java/com/pancm/domain/CanalDO.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package com.pancm.domain; | ||
|
||
import lombok.Data; | ||
|
||
import javax.persistence.*; | ||
import java.sql.Date; | ||
|
||
/** | ||
* @author pancm | ||
* @Title: springBoot-study | ||
* @Description: | ||
* @Version:1.0.0 | ||
* @Since:jdk1.8 | ||
* @date 2023/9/15 | ||
*/ | ||
@Data | ||
@Entity | ||
@Table(name = "business_monitoring_original_data") | ||
public class CanalDO { | ||
@Id | ||
@GeneratedValue(strategy = GenerationType.AUTO) | ||
private Long id; | ||
private Date createTime; | ||
private Date updateTime; | ||
private String binlogName; | ||
private String dbName; | ||
private String tableName; | ||
private String event_type; | ||
private String keyName; | ||
private String keyValue; | ||
private String timeIndex; | ||
private String gatherTime; | ||
|
||
|
||
|
||
} |
21 changes: 21 additions & 0 deletions
21
springboot-prometheus-canal/src/main/java/com/pancm/service/ICanalService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package com.pancm.service; | ||
|
||
import com.pancm.domain.CanalDO; | ||
|
||
import java.util.List; | ||
|
||
/** | ||
* @author pancm | ||
* @Title: springBoot-study | ||
* @Description: | ||
* @Version:1.0.0 | ||
* @Since:jdk1.8 | ||
* @date 2023/8/25 | ||
*/ | ||
public interface ICanalService { | ||
|
||
CanalDO save(CanalDO canalDO); | ||
|
||
List<CanalDO> query(CanalDO canalDO); | ||
|
||
} |
34 changes: 34 additions & 0 deletions
34
springboot-prometheus-canal/src/main/java/com/pancm/service/impl/CanalServiceImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package com.pancm.service.impl; | ||
|
||
import com.pancm.dao.CanalRepository; | ||
import com.pancm.domain.CanalDO; | ||
import com.pancm.service.ICanalService; | ||
import org.springframework.stereotype.Service; | ||
|
||
import javax.annotation.Resource; | ||
import java.util.List; | ||
|
||
/** | ||
* @author pancm | ||
* @Title: springBoot-study | ||
* @Description: | ||
* @Version:1.0.0 | ||
* @Since:jdk1.8 | ||
* @date 2023/9/15 | ||
*/ | ||
@Service | ||
public class CanalServiceImpl implements ICanalService { | ||
|
||
@Resource | ||
private CanalRepository canalRepository; | ||
|
||
@Override | ||
public CanalDO save(CanalDO canalDO) { | ||
return canalRepository.save(canalDO); | ||
} | ||
|
||
@Override | ||
public List<CanalDO> query(CanalDO canalDO) { | ||
return canalRepository.findAll(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
spring.port = 8787 | ||
server.port= 8787 | ||
spring.application.name=springboot-prometheus-canal | ||
# /health端点 暴露详细信息 | ||
management.endpoint.health.show-details=always | ||
|
@@ -18,6 +18,9 @@ [email protected]@ | |
info.app.description=@project.description@ | ||
info.app.version=@project.version@ | ||
|
||
|
||
spring.datasource.url=jdbc:mysql://localhost:3306/canal?useUnicode=true&characterEncoding=utf8 | ||
spring.datasource.username=root | ||
spring.datasource.password=123456 | ||
spring.datasource.driverClassName=com.mysql.jdbc.Driver | ||
|
||
|