Skip to content
Closed
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
6 changes: 3 additions & 3 deletions ballerina/Ballerina.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
org = "ballerinax"
name = "mssql"
version = "1.16.2"
version = "1.16.3"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Version bump looks good, but verify PR title accuracy.

The version bump to 1.16.3 is consistent across all configuration files. However, the PR title mentions "MySQL CDC listener" while this is the MSSQL (Microsoft SQL Server) module. Please verify if the PR title is accurate or if it's a copy-paste error.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@ballerina/Ballerina.toml` at line 4, The PR title references "MySQL CDC
listener" but the change is in the MSSQL (Microsoft SQL Server) module (see
version = "1.16.3" in Ballerina.toml and module context), so verify and correct
the PR title and any related metadata to reflect MSSQL if this is not a MySQL
change; if the change truly targets MySQL, update the module files to match or
adjust the bumped file to the correct module. Also check and update any
changelog/commit messages and PR description to consistently say "MSSQL CDC
listener" (or the correct DB) so the title, description, and files align.

authors = ["Ballerina"]
keywords = ["client", "network", "SQL", "RDBMS", "SQLServer", "MSSQL", "Vendor/Microsoft", "Area/Database", "Type/Connector"]
repository = "https://github.com/ballerina-platform/module-ballerinax-mssql"
Expand All @@ -15,8 +15,8 @@ graalvmCompatible = true
[[platform.java21.dependency]]
groupId = "io.ballerina.stdlib"
artifactId = "mssql-native"
version = "1.16.2"
path = "../native/build/libs/mssql-native-1.16.2.jar"
version = "1.16.3"
path = "../native/build/libs/mssql-native-1.16.3-SNAPSHOT.jar"

[[platform.java21.dependency]]
groupId = "io.ballerina.stdlib"
Expand Down
2 changes: 1 addition & 1 deletion ballerina/CompilerPlugin.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ id = "mssql-compiler-plugin"
class = "io.ballerina.stdlib.mssql.compiler.MSSQLCompilerPlugin"

[[dependency]]
path = "../compiler-plugin/build/libs/mssql-compiler-plugin-1.16.2.jar"
path = "../compiler-plugin/build/libs/mssql-compiler-plugin-1.16.3-SNAPSHOT.jar"
70 changes: 55 additions & 15 deletions ballerina/Dependencies.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,14 @@ dependencies = [
{org = "ballerina", name = "log"}
]

[[package]]
org = "ballerina"
name = "avro"
version = "1.2.0"
dependencies = [
{org = "ballerina", name = "jballerina.java"}
]

[[package]]
org = "ballerina"
name = "cache"
Expand All @@ -44,7 +52,7 @@ dependencies = [
[[package]]
org = "ballerina"
name = "crypto"
version = "2.9.0"
version = "2.9.3"
dependencies = [
{org = "ballerina", name = "jballerina.java"},
{org = "ballerina", name = "time"}
Expand All @@ -56,7 +64,7 @@ modules = [
[[package]]
org = "ballerina"
name = "data.jsondata"
version = "1.1.0"
version = "1.1.3"
dependencies = [
{org = "ballerina", name = "jballerina.java"},
{org = "ballerina", name = "lang.object"}
Expand Down Expand Up @@ -127,7 +135,7 @@ modules = [
[[package]]
org = "ballerina"
name = "jwt"
version = "2.15.0"
version = "2.15.1"
scope = "testOnly"
dependencies = [
{org = "ballerina", name = "cache"},
Expand All @@ -144,7 +152,6 @@ dependencies = [
org = "ballerina"
name = "lang.__internal"
version = "0.0.0"
scope = "testOnly"
dependencies = [
{org = "ballerina", name = "jballerina.java"},
{org = "ballerina", name = "lang.object"}
Expand Down Expand Up @@ -182,7 +189,6 @@ dependencies = [
org = "ballerina"
name = "lang.int"
version = "0.0.0"
scope = "testOnly"
dependencies = [
{org = "ballerina", name = "jballerina.java"},
{org = "ballerina", name = "lang.__internal"},
Expand Down Expand Up @@ -249,7 +255,6 @@ dependencies = [
org = "ballerina"
name = "log"
version = "2.12.0"
scope = "testOnly"
dependencies = [
{org = "ballerina", name = "io"},
{org = "ballerina", name = "jballerina.java"},
Expand All @@ -260,7 +265,7 @@ dependencies = [
[[package]]
org = "ballerina"
name = "mime"
version = "2.12.0"
version = "2.12.1"
scope = "testOnly"
dependencies = [
{org = "ballerina", name = "io"},
Expand All @@ -286,15 +291,15 @@ dependencies = [
[[package]]
org = "ballerina"
name = "observe"
version = "1.5.0"
version = "1.5.1"
dependencies = [
{org = "ballerina", name = "jballerina.java"}
]

[[package]]
org = "ballerina"
name = "os"
version = "1.10.0"
version = "1.10.1"
scope = "testOnly"
dependencies = [
{org = "ballerina", name = "io"},
Expand Down Expand Up @@ -342,7 +347,7 @@ modules = [
[[package]]
org = "ballerina"
name = "time"
version = "2.7.0"
version = "2.8.0"
dependencies = [
{org = "ballerina", name = "jballerina.java"}
]
Expand All @@ -353,7 +358,7 @@ modules = [
[[package]]
org = "ballerina"
name = "url"
version = "2.6.0"
version = "2.6.1"
scope = "testOnly"
dependencies = [
{org = "ballerina", name = "jballerina.java"}
Expand All @@ -363,7 +368,6 @@ dependencies = [
org = "ballerina"
name = "uuid"
version = "1.10.0"
scope = "testOnly"
dependencies = [
{org = "ballerina", name = "crypto"},
{org = "ballerina", name = "jballerina.java"},
Expand Down Expand Up @@ -405,21 +409,57 @@ modules = [
[[package]]
org = "ballerinax"
name = "cdc"
version = "1.0.2"
version = "1.2.0"
dependencies = [
{org = "ballerina", name = "crypto"},
{org = "ballerina", name = "data.jsondata"},
{org = "ballerina", name = "io"},
{org = "ballerina", name = "jballerina.java"},
{org = "ballerinai", name = "observe"}
{org = "ballerina", name = "log"},
{org = "ballerinai", name = "observe"},
{org = "ballerinax", name = "kafka"}
]
modules = [
{org = "ballerinax", packageName = "cdc", moduleName = "cdc"}
]

[[package]]
org = "ballerinax"
name = "confluent.cavroserdes"
version = "1.0.2"
dependencies = [
{org = "ballerina", name = "avro"},
{org = "ballerina", name = "jballerina.java"},
{org = "ballerinai", name = "observe"},
{org = "ballerinax", name = "confluent.cregistry"}
]

[[package]]
org = "ballerinax"
name = "confluent.cregistry"
version = "0.4.3"
dependencies = [
{org = "ballerina", name = "jballerina.java"}
]

[[package]]
org = "ballerinax"
name = "kafka"
version = "4.6.3"
dependencies = [
{org = "ballerina", name = "crypto"},
{org = "ballerina", name = "jballerina.java"},
{org = "ballerina", name = "time"},
{org = "ballerina", name = "uuid"},
{org = "ballerinai", name = "observe"},
{org = "ballerinax", name = "confluent.cavroserdes"},
{org = "ballerinax", name = "confluent.cregistry"}
]

[[package]]
org = "ballerinax"
name = "mssql"
version = "1.16.2"
version = "1.16.3"
dependencies = [
{org = "ballerina", name = "crypto"},
{org = "ballerina", name = "file"},
Expand Down
16 changes: 10 additions & 6 deletions ballerina/cdc_listener.bal
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,21 @@ import ballerinax/cdc;
public isolated class CdcListener {
*cdc:Listener;

private final map<string> & readonly config;
private final map<anydata> & readonly config;
private boolean isStarted = false;
private boolean hasAttachedService = false;

# Initializes the MSSQL listener with the given configuration.
#
# + config - The configuration for the MSSQL connector
public isolated function init(*MsSqlListenerConfiguration config) {
map<string> configMap = {};
map<string> debeziumConfigs = {};
cdc:populateDebeziumProperties({
engineName: config.engineName,
offsetStorage: config.offsetStorage,
internalSchemaStorage: config.internalSchemaStorage,
options: config.options
}, configMap);
}, debeziumConfigs);
cdc:populateDatabaseConfigurations({
connectorClass: config.database.connectorClass,
hostname: config.database.hostname,
Expand All @@ -47,9 +47,13 @@ public isolated class CdcListener {
excludedTables: config.database.excludedTables,
includedColumns: config.database.includedColumns,
excludedColumns: config.database.excludedColumns
}, configMap);
populateMsSqlConfigurations(config.database, configMap);
self.config = configMap.cloneReadOnly();
}, debeziumConfigs);
populateMsSqlConfigurations(config.database, debeziumConfigs);
map<anydata> listenerConfigs = {
...debeziumConfigs
};
listenerConfigs["livenessInterval"] = config.livenessInterval;
self.config = listenerConfigs.cloneReadOnly();
}

# Attaches a CDC service to the MSSQL listener.
Expand Down
107 changes: 107 additions & 0 deletions ballerina/tests/listener_liveness_test.bal
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
// Copyright (c) 2026, WSO2 LLC. (https://www.wso2.com).
//
// WSO2 LLC. licenses this file to you under the Apache License,
// Version 2.0 (the "License"); you may not use this file except
// in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.

import ballerina/lang.runtime;
import ballerina/test;
import ballerinax/cdc;

@test:Config {
groups: ["liveness"]
}
function testLivenessBeforeListenerStart() returns error? {
CdcListener mssqlListener = new ({
database: {
username: cdcUsername,
password: cdcPassword,
port: cdcPort,
databaseNames: cdcDatabase
},
options: {
snapshotMode: cdc:NO_DATA
}
});
check mssqlListener.attach(testService);
boolean liveness = check cdc:isLive(mssqlListener);
test:assertFalse(liveness, "Liveness check passes even before listener starts");
}

@test:Config {
groups: ["liveness"]
}
function testLivenessWithStartedListener() returns error? {
CdcListener mssqlListener = new ({
database: {
username: cdcUsername,
password: cdcPassword,
port: cdcPort,
databaseNames: cdcDatabase
},
options: {
snapshotMode: cdc:NO_DATA
}
});
check mssqlListener.attach(testService);
check mssqlListener.'start();
boolean liveness = check cdc:isLive(mssqlListener);
test:assertTrue(liveness, "Liveness fails for a started listener");
check mssqlListener.gracefulStop();
}

@test:Config {
groups: ["liveness"]
}
function testLivenessAfterListenerStop() returns error? {
CdcListener mssqlListener = new ({
database: {
username: cdcUsername,
password: cdcPassword,
port: cdcPort,
databaseNames: cdcDatabase
},
options: {
snapshotMode: cdc:NO_DATA
}
});
check mssqlListener.attach(testService);
check mssqlListener.'start();
check mssqlListener.gracefulStop();
boolean liveness = check cdc:isLive(mssqlListener);
test:assertFalse(liveness, "Liveness check passes after the listener has stopped");
}

@test:Config {
groups: ["liveness"]
}
function testLivenessWithoutReceivingEvents() returns error? {
CdcListener mssqlListener = new ({
database: {
username: cdcUsername,
password: cdcPassword,
port: cdcPort,
databaseNames: cdcDatabase
},
options: {
snapshotMode: cdc:NO_DATA
},
livenessInterval: 5.0
});
check mssqlListener.attach(testService);
check mssqlListener.'start();
runtime:sleep(10);
boolean liveness = check cdc:isLive(mssqlListener);
test:assertFalse(liveness, "Liveness check passes even after not receiving events within the liveness interval");
check mssqlListener.gracefulStop();
}
4 changes: 4 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,13 @@ subprojects {
ballerinaStdLibs "io.ballerina.stdlib:observe-ballerina:${observeVersion}"
ballerinaStdLibs "io.ballerina:observe-ballerina:${observeInternalVersion}"
ballerinaStdLibs "io.ballerina.stdlib:mssql.driver-ballerina:${stdlibMssqlDriverVersion}"
ballerinaStdLibs "io.ballerina.lib:avro-ballerina:${stdlibAvroVersion}"

ballerinaStdLibs "io.ballerina.lib:cdc-ballerina:${stdlibCdcVersion}"
ballerinaStdLibs "io.ballerina.lib:mssql.cdc.driver-ballerina:${stdlibMSSQLCdcDriverVersion}"
ballerinaStdLibs "io.ballerina.stdlib:kafka-ballerina:${stdlibKafkaVersion}"
ballerinaStdLibs "io.ballerina.lib:confluent.cavroserdes-ballerina:${stdlibConfluentAvroSerDesVersion}"
ballerinaStdLibs "io.ballerina.lib:confluent.cregistry-ballerina:${stdlibConfluentSchemaRegistryVersion}"
}
}

Expand Down
Loading
Loading