-
Notifications
You must be signed in to change notification settings - Fork 4
Introduce liveness-check mechanism for the CDC listener #24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 19 commits
4b32bb0
3f78a32
d07b39e
1af8ca8
82dc401
172d5d8
60860e9
706ca06
c9d119d
cdda861
de7b854
4c94c04
2846906
a9b5d3c
0adc17b
10e43bd
e1c1539
b9d007a
35697e0
b83ff70
be8da3e
9e9110b
25efdc2
41a6a26
839f938
083532f
1194337
ba705ee
a36fcc0
c91a6a7
32eac11
c91b148
23ca6d3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,7 +5,7 @@ | |
|
|
||
| [ballerina] | ||
| dependencies-toml-version = "2" | ||
| distribution-version = "2201.12.0" | ||
| distribution-version = "2201.13.1" | ||
coderabbitai[bot] marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| [[package]] | ||
| org = "ballerina" | ||
|
|
@@ -18,7 +18,7 @@ dependencies = [ | |
| [[package]] | ||
| org = "ballerina" | ||
| name = "crypto" | ||
| version = "2.9.3" | ||
| version = "2.10.1" | ||
| dependencies = [ | ||
| {org = "ballerina", name = "jballerina.java"}, | ||
| {org = "ballerina", name = "time"} | ||
|
|
@@ -30,7 +30,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"} | ||
|
|
@@ -144,7 +144,7 @@ dependencies = [ | |
| [[package]] | ||
| org = "ballerina" | ||
| name = "log" | ||
| version = "2.12.0" | ||
| version = "2.16.1" | ||
| dependencies = [ | ||
| {org = "ballerina", name = "io"}, | ||
| {org = "ballerina", name = "jballerina.java"}, | ||
|
|
@@ -158,7 +158,7 @@ modules = [ | |
| [[package]] | ||
| org = "ballerina" | ||
| name = "observe" | ||
| version = "1.5.0" | ||
| version = "1.7.0" | ||
| dependencies = [ | ||
| {org = "ballerina", name = "jballerina.java"} | ||
| ] | ||
|
|
@@ -179,7 +179,7 @@ modules = [ | |
| [[package]] | ||
| org = "ballerina" | ||
| name = "sql" | ||
| version = "1.16.0" | ||
| version = "1.17.1" | ||
| scope = "testOnly" | ||
| dependencies = [ | ||
| {org = "ballerina", name = "io"}, | ||
|
|
@@ -236,7 +236,7 @@ modules = [ | |
| [[package]] | ||
| org = "ballerinax" | ||
| name = "cdc" | ||
| version = "1.1.0" | ||
| version = "1.1.1" | ||
| dependencies = [ | ||
| {org = "ballerina", name = "crypto"}, | ||
| {org = "ballerina", name = "data.jsondata"}, | ||
|
|
@@ -277,7 +277,7 @@ dependencies = [ | |
| [[package]] | ||
| org = "ballerinax" | ||
| name = "java.jdbc" | ||
| version = "1.14.0" | ||
| version = "1.14.1" | ||
| scope = "testOnly" | ||
| dependencies = [ | ||
| {org = "ballerina", name = "io"}, | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -40,6 +40,7 @@ The conforming implementation of the specification is released and included in t | |||||
| - [2.2.4.5 `onTruncate`](#2245-ontruncate) | ||||||
| - [2.2.4.6 `onError`](#2246-onerror) | ||||||
| - [2.2.5 Service Configuration](#225-service-configuration) | ||||||
| - [2.2 Using health checks](#23-using-health-checks) | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fix the section numbering in the table of contents. The link text says "2.2 Using health checks" but it should be "2.3" to match the actual section number. 📝 Proposed fix- - [2.2 Using health checks](`#23-using-health-checks`)
+ - [2.3 Using health checks](`#23-using-health-checks`) 🤖 Prompt for AI Agents |
||||||
| - [3. Errors](#3-errors) | ||||||
| - [3.1 Service Error Handling](#31-service-error-handling) | ||||||
| - [Example: `onCreate` Throwing an Error](#example-oncreate-throwing-an-error) | ||||||
|
|
@@ -289,6 +290,39 @@ remote function onError(cdc:Error e) { | |||||
|
|
||||||
| The `cdc:ServiceConfig` annotation can be used to provide additional configurations to the CDC service. These configurations are described in the [Service Configuration](#41-service-config) section. | ||||||
|
|
||||||
| ### 2.3 Using health checks | ||||||
|
|
||||||
| In a distributed deployment, health checks are essential for monitoring the state of the CDC listener and enabling automated recovery mechanisms. If the listener becomes unhealthy, the orchestrator (e.g., Kubernetes) can restart the service based on the reported health status. | ||||||
|
|
||||||
| To support this, the `isLive` function is provided to determine the liveness of a given CDC listener instance. | ||||||
|
|
||||||
| ```ballerina | ||||||
| # Checks whether the given CDC listener is live. | ||||||
| # | ||||||
| # + cdc - The CDC listener instance to be checked | ||||||
| # + return - Returns `true` if the listener is considered live, `false` otherwise, | ||||||
| # or an error if the liveness check fails | ||||||
| public function isLive(cdc: Listener cdc) returns boolean|Error; | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Syntax error in function signature. The parameter type has an incorrect space: 📝 Proposed fix-public function isLive(cdc: Listener cdc) returns boolean|Error;
+public function isLive(cdc:Listener cdc) returns boolean|Error;📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||
| ``` | ||||||
|
|
||||||
| The following example demonstrates how the `isLive` function can be integrated with an HTTP-based liveness probe: | ||||||
|
|
||||||
| ```ballerina | ||||||
| listener cdc:Listener mssqlCdc = ...; | ||||||
|
|
||||||
| // HTTP-based liveness probe | ||||||
| service on new http:Listener(...) { | ||||||
|
|
||||||
| resource function get liveness() returns http:Ok|http:ServiceUnavailable { | ||||||
| boolean isLive = cdc:isLive(mssqlCdc); | ||||||
| if isLive { | ||||||
| return http:OK; | ||||||
| } | ||||||
| return http:SERVICE_UNAVAILABLE; | ||||||
| } | ||||||
|
||||||
| } | ||||||
| ``` | ||||||
|
|
||||||
| ## 3. Errors | ||||||
|
|
||||||
| ### 3.1 Service Error Handling | ||||||
|
|
||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't we need to bump this to 1.2.0?