How To Setup Eventuate-Tram-Cdc Service Locally - by Erandika Harshani - Medium
How To Setup Eventuate-Tram-Cdc Service Locally - by Erandika Harshani - Medium
Erandika Harshani
12 Followers About Follow
Eventuate Tram is a platform that solves the distributed data management problems
inherent in a microservice architecture. It’s for Java/Spring-based microservices that use
the traditional JDBC/JPA-based persistence model.- eventuate-tram
2] Start your zookeeper and kafka services; use kafka_2.12–2.2.0 version. This package
has both zookeeper and kafka configuration files.
3] By default, eventuate works with mysql binlog. In that case, you have to enable mysql
binlog configuration. If you don’t want to enable mysql binlog, you can use
‘spring.profiles.active=EventuatePolling’ property in application.properties file. Start
mysql service.
https://medium.com/@erandika_harshani/how-to-setup-eventuate-tram-framework-locally-b27f5ba36b87 1/6
5/8/2021 How to setup Eventuate-tram-cdc Service locally | by Erandika Harshani | Medium
USE eventuate;
https://medium.com/@erandika_harshani/how-to-setup-eventuate-tram-framework-locally-b27f5ba36b87 2/6
5/8/2021 How to setup Eventuate-tram-cdc Service locally | by Erandika Harshani | Medium
You have to execute the following sql commands if you are going to use the newer
eventuate tram version(0.21.3.RELEASE).
spring.datasource.url=jdbc:mysql://localhost:3306/eventuate?
autoReconnect=true&useSSL=false
spring.datasource.username=root
spring.datasource.password=password
spring.datasource.driver.class.name=com.mysql.jdbc.Driver
eventuatelocal.kafka.bootstrap.servers=localhost:9092
eventuatelocal.zookeeper.connection.string=localhost:2181
eventuatelocal.cdc.db.user.name=root
eventuatelocal.cdc.db.password=password
eventuate.database.schema=eventuate
https://medium.com/@erandika_harshani/how-to-setup-eventuate-tram-framework-locally-b27f5ba36b87 3/6
5/8/2021 How to setup Eventuate-tram-cdc Service locally | by Erandika Harshani | Medium
eventuatelocal.cdc.source.table.name=MESSAGE
eventuate.cdc.type=EventuateTram
Get started Open in app
spring.profiles.active=EventuatePolling
eventuatelocal.cdc.read.old.debezium.db.offset.storage.topic=false
eventuatelocal.cdc.reader.name=customcdcreader
eventuatelocal.cdc.mysql.binlog.client.unique.id=1
eventuatelocal.cdc.offset.storage.topic.name=db.history.common
eventuatelocal.cdc.leadership.lock.path=/eventuatelocal/cdc/leader/1
Now you are eligible to up the tram-cdc service. Following is the command to start the
tram-cdc-service.
From the console log, you can see whether eventuate-tram-cdc-service is up. After a
successful starting, you can use this service for your purposes.
Sample-Customer-Service
Sample Customer Service is used to publish events using eventuate-tram-cdc-service
when inserting customers to its database.
This repository is a spring-boot application. Clone and start the sample service and use
the following CURL to add customers to the database.
Request:
curl -X POST \
http://localhost:8085/customer_service/add_customer \
-H ‘content-type: application/json’ \
-d ‘{
“name”: “demo user”,
“email”: “[email protected]”,
“country”: “SL”
}’
https://medium.com/@erandika_harshani/how-to-setup-eventuate-tram-framework-locally-b27f5ba36b87 4/6
5/8/2021 How to setup Eventuate-tram-cdc Service locally | by Erandika Harshani | Medium
Response:
Get started Open in app
HTTP/1.1 200
Content-Type: application/json;charset=UTF-8
{
“customerId”: 1
}
you can see your customer database is updated with your request payload;
if you execute kafka topic consume command with your event topic(this can find
from MESSAGE table destination column), it has a new record with your request.
References:
Eventuate Tram
Eventuate Tram is a platform that solves the distributed data
management problems inherent in a microservice…
eventuate.io
eventuate-tram/eventuate-tram-core
Maintain data consistency using sagas Implement commands that
update data in multiple microservices by using Sagas…
github.com
eventuate-tram/eventuate-tram-examples-customers-and-orders
This application demonstrates two key patterns: The application consists of three services:
Order Service - manages…
github.com
https://medium.com/@erandika_harshani/how-to-setup-eventuate-tram-framework-locally-b27f5ba36b87 5/6
5/8/2021 How to setup Eventuate-tram-cdc Service locally | by Erandika Harshani | Medium
https://medium.com/@erandika_harshani/how-to-setup-eventuate-tram-framework-locally-b27f5ba36b87 6/6