Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 11 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,13 @@ Create a CDC listener for your MySQL database by specifying the connection detai

```ballerina
listener mysql:CdcListener mysqlListener = new ({
hostname: "localhost",
port: 3306,
username: "username",
password: "password",
databaseInclude: ["inventory"]
database: {
hostname: "localhost",
port: 3306,
username: "username",
password: "password",
includedDatabases: ["inventory"]
}
});
```

Expand All @@ -52,22 +54,22 @@ Implement a `cdc:Service` to handle database change events:
```ballerina
service on mysqlListener {

remote function onRead(record {} after) returns error? {
remote function onRead(record {} after) returns cdc:Error? {
// Handle the read event
log:printInfo(`Record read: ${after}`);
}

remote function onCreate(record {} after) returns error? {
remote function onCreate(record {} after) returns cdc:Error? {
// Handle the create event
log:printInfo(`Record created: ${after}`);
}

remote function onUpdate(record {} before, record {} after) returns error? {
remote function onUpdate(record {} before, record {} after) returns cdc:Error? {
// Handle the update event
log:printInfo(`Record updated from: ${before}, to ${after}`);
}

remote function onDelete(record {} before) returns error? {
remote function onDelete(record {} before) returns cdc:Error? {
// Handle the delete event
log:printInfo(`Record deleted: ${before}`);
}
Expand Down
20 changes: 11 additions & 9 deletions ballerina/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,13 @@ Create a CDC listener for your MySQL database by specifying the connection detai

```ballerina
listener mysql:CdcListener mysqlListener = new ({
hostname: "localhost",
port: 3306,
username: "username",
password: "password",
databaseInclude: ["inventory"]
database: {
hostname: "localhost",
port: 3306,
username: "username",
password: "password",
includedDatabases: ["inventory"]
}
});
```

Expand All @@ -44,22 +46,22 @@ Implement a `cdc:Service` to handle database change events:
```ballerina
service on mysqlListener {

remote function onRead(record {} after) returns error? {
remote function onRead(record {} after) returns cdc:Error? {
// Handle the read event
log:printInfo(`Record read: ${after}`);
}

remote function onCreate(record {} after) returns error? {
remote function onCreate(record {} after) returns cdc:Error? {
// Handle the create event
log:printInfo(`Record created: ${after}`);
}

remote function onUpdate(record {} before, record {} after) returns error? {
remote function onUpdate(record {} before, record {} after) returns cdc:Error? {
// Handle the update event
log:printInfo(`Record updated from: ${before}, to ${after}`);
}

remote function onDelete(record {} before) returns error? {
remote function onDelete(record {} before) returns cdc:Error? {
// Handle the delete event
log:printInfo(`Record deleted: ${before}`);
}
Expand Down
5 changes: 5 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Added

### Changed
- Fix documentation

## [1.0.3] - 2025-05-29

### Changed
- Fixed schema not included in service map key
- Fix data binding error being invoked incorrectly
Expand Down