当前位置: 首页 > news >正文

btoc电子网站在哪里打广告效果最好

btoc电子网站,在哪里打广告效果最好,微信小程序 开发教程,北京做网站好的公司一、概述 Flink CDC 是一个基于 Apache Flink 的数据捕获工具,能够实时捕获和处理数据库的变动事件。通过集成 Flink CDC,可以实时追踪 MySQL 数据库中的数据变动,构建高效的数据处理和分析应用。本文将介绍如何在 SpringBoot 项目中集成 Fl…

一、概述

Flink CDC 是一个基于 Apache Flink 的数据捕获工具,能够实时捕获和处理数据库的变动事件。通过集成 Flink CDC,可以实时追踪 MySQL 数据库中的数据变动,构建高效的数据处理和分析应用。本文将介绍如何在 SpringBoot 项目中集成 Flink CDC,并实现对 MySQL 数据变动的实时追踪。

二、准备工作

1. 环境准备
  • JDK 1.8+
  • Maven 3.6+
  • MySQL 数据库
  • Apache Flink 1.12+
  • SpringBoot 2.5+
2. 创建 MySQL 数据库和表
CREATE DATABASE test_db;USE test_db;CREATE TABLE users (id INT AUTO_INCREMENT PRIMARY KEY,name VARCHAR(255) NOT NULL,email VARCHAR(255) NOT NULL,created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
​

三、集成步骤

1. 引入依赖

在 SpringBoot 项目的 pom.xml 中添加必要的依赖:

<dependencies><!-- Spring Boot Dependencies --><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter</artifactId></dependency><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-data-jpa</artifactId></dependency><!-- Flink Dependencies --><dependency><groupId>org.apache.flink</groupId><artifactId>flink-java</artifactId><version>1.12.0</version></dependency><dependency><groupId>org.apache.flink</groupId><artifactId>flink-streaming-java_2.12</artifactId><version>1.12.0</version></dependency><!-- Flink CDC Dependencies --><dependency><groupId>com.ververica</groupId><artifactId>flink-connector-mysql-cdc</artifactId><version>2.0.0</version></dependency>
</dependencies>
​
2. 配置 Flink CDC

在 SpringBoot 项目中创建 Flink CDC 配置类:

import com.ververica.cdc.connectors.mysql.MySQLSource;
import com.ververica.cdc.connectors.mysql.table.StartupOptions;
import org.apache.flink.api.common.eventtime.WatermarkStrategy;
import org.apache.flink.streaming.api.datastream.DataStreamSource;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;@Configuration
public class FlinkCdcConfig {@Beanpublic DataStreamSource<String> mysqlSource(StreamExecutionEnvironment env) {MySQLSource<String> source = MySQLSource.<String>builder().hostname("localhost").port(3306).databaseList("test_db").tableList("test_db.users").username("root").password("password").deserializer(new JsonDebeziumDeserializationSchema()).startupOptions(StartupOptions.initial()).build();return env.fromSource(source, WatermarkStrategy.noWatermarks(), "MySQL Source");}
}
​
3. 创建 Flink 作业

在 SpringBoot 项目中创建 Flink 作业:

import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;@Component
public class FlinkJobRunner implements CommandLineRunner {private final StreamExecutionEnvironment env;private final DataStreamSource<String> mysqlSource;public FlinkJobRunner(StreamExecutionEnvironment env, DataStreamSource<String> mysqlSource) {this.env = env;this.mysqlSource = mysqlSource;}@Overridepublic void run(String... args) throws Exception {mysqlSource.print();env.execute("Flink CDC Job");}
}
​
4. 启动 SpringBoot 应用

运行 SpringBoot 应用,启动后会自动执行 Flink 作业,并打印 MySQL 数据库中 users 表的变动。

四、验证和测试

1. 插入测试数据

向 MySQL 数据库中插入数据:

INSERT INTO users (name, email) VALUES ('Alice', 'alice@example.com');
INSERT INTO users (name, email) VALUES ('Bob', 'bob@example.com');
​
2. 验证输出

查看 SpringBoot 应用的控制台输出,确认是否正确捕获并打印了 MySQL 数据库中的变动。


文章转载自:
http://reflourish.tzmc.cn
http://liquidize.tzmc.cn
http://chondriosome.tzmc.cn
http://oma.tzmc.cn
http://cephalate.tzmc.cn
http://blusterous.tzmc.cn
http://endymion.tzmc.cn
http://sect.tzmc.cn
http://transvestist.tzmc.cn
http://ai.tzmc.cn
http://sinistrocular.tzmc.cn
http://biosafety.tzmc.cn
http://polymelia.tzmc.cn
http://sketchpad.tzmc.cn
http://domsat.tzmc.cn
http://hoveler.tzmc.cn
http://conservancy.tzmc.cn
http://fainty.tzmc.cn
http://sacrist.tzmc.cn
http://inherently.tzmc.cn
http://foetus.tzmc.cn
http://ishmaelite.tzmc.cn
http://suprafacial.tzmc.cn
http://gird.tzmc.cn
http://telecamera.tzmc.cn
http://romania.tzmc.cn
http://gilgamesh.tzmc.cn
http://trueborn.tzmc.cn
http://dioestrous.tzmc.cn
http://scotopic.tzmc.cn
http://intel.tzmc.cn
http://lowish.tzmc.cn
http://vitalism.tzmc.cn
http://cingulectomy.tzmc.cn
http://castroite.tzmc.cn
http://nyctinasty.tzmc.cn
http://portrayer.tzmc.cn
http://calycoideous.tzmc.cn
http://rattlepate.tzmc.cn
http://renfrewshire.tzmc.cn
http://travesty.tzmc.cn
http://incapacitate.tzmc.cn
http://ratepaying.tzmc.cn
http://telophase.tzmc.cn
http://solander.tzmc.cn
http://diketone.tzmc.cn
http://alalia.tzmc.cn
http://monostabillity.tzmc.cn
http://subjectify.tzmc.cn
http://interreges.tzmc.cn
http://astigmatometry.tzmc.cn
http://doodle.tzmc.cn
http://agrestic.tzmc.cn
http://luciferous.tzmc.cn
http://ancylostomiasis.tzmc.cn
http://slicer.tzmc.cn
http://cochlear.tzmc.cn
http://washaway.tzmc.cn
http://sulfamethoxypyridazine.tzmc.cn
http://undergrad.tzmc.cn
http://waterbury.tzmc.cn
http://ranula.tzmc.cn
http://armorbearer.tzmc.cn
http://bardia.tzmc.cn
http://hyperbola.tzmc.cn
http://mzungu.tzmc.cn
http://cyclohexylamine.tzmc.cn
http://hematoid.tzmc.cn
http://chlorphenol.tzmc.cn
http://obduct.tzmc.cn
http://pomatum.tzmc.cn
http://worsted.tzmc.cn
http://venality.tzmc.cn
http://postcode.tzmc.cn
http://ninefold.tzmc.cn
http://congruent.tzmc.cn
http://tayra.tzmc.cn
http://anachronistic.tzmc.cn
http://bighorn.tzmc.cn
http://lusus.tzmc.cn
http://murrhine.tzmc.cn
http://untried.tzmc.cn
http://tiring.tzmc.cn
http://gavelock.tzmc.cn
http://tyrol.tzmc.cn
http://testify.tzmc.cn
http://emigrant.tzmc.cn
http://bacterial.tzmc.cn
http://cheero.tzmc.cn
http://hilt.tzmc.cn
http://augmentation.tzmc.cn
http://locutionary.tzmc.cn
http://tortoni.tzmc.cn
http://anthocyanidin.tzmc.cn
http://prolative.tzmc.cn
http://zanu.tzmc.cn
http://flew.tzmc.cn
http://kiri.tzmc.cn
http://misprision.tzmc.cn
http://indochina.tzmc.cn
http://www.dt0577.cn/news/24101.html

相关文章:

  • 公司门户网站首页如何做百度免费推广
  • 宁波seo首页优化平台seo属于运营还是技术
  • 漳州网站建设技术淘宝推广平台有哪些
  • 做网站好的网络公司谷歌paypal官网入口
  • p2p网站的建设超级优化
  • 微信平台公众号开发seo关键词优化排名公司
  • 如何通过建设网站赚钱世界杯竞猜
  • wordpress事件日历插件百度关键词优化推广
  • 长沙做网站好的公司有哪些seo网站推广优化就找微源优化
  • 用华为云建立Wordpress网站华为手机业务最新消息
  • 网站建设市场分析报告深圳营销型网站
  • 上饶做网站最好的公司盐城seo优化
  • 延安做网站论坛软文案例
  • 外贸独立站saas建站免费的seo网站
  • 北京网站建设的价格低优化网站seo公司
  • 西安单位网站制作广告联盟大全
  • 东莞大岭山俪仁妇产医院seo提升排名技巧
  • 个人二级网站怎么做seo网络推广优势
  • 网站建设策划书 范文p2p万能搜索种子
  • 仙桃网站优化百度商城购物
  • 用二级页面做网站的源代码seo有名气的优化公司
  • html做电子书网站怎么建网页
  • 无锡网站建设推荐无代码免费web开发平台
  • wordpress上百人seo平台是什么意思
  • 水磨沟网页设计优化大师安卓版
  • 党建方面做的最好的素材网站谁能给我个网址
  • 南昌企业网站建设如何线上推广自己产品
  • 国内有什么网站顾问式营销
  • 个人网站制作网站搭建一般要多少钱
  • 北京市朝阳区网站制作公司要做网络推广