Skip to content
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

Remove deprecated nats:Message usages #797

Merged
merged 9 commits into from
Apr 10, 2024
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
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ nats:Error? result =
2. Publish as a request that expects a reply:
```ballerina
string message = "hello world";
nats:Message|nats:Error reqReply =
nats:AnydataMessage|nats:Error reqReply =
natsClient->requestMessage({ content: message.toBytes(), subject: "demo.nats.basic"}, 5);
```

Expand All @@ -76,7 +76,7 @@ nats:Error? result = natsClient->publish({ content: message.toBytes(), subject:
}
service nats:Service on new nats:Listener(nats:DEFAULT_URL) {

remote function onMessage(nats:Message message) {
remote function onMessage(nats:AnydataMessage message) {
}
}
```
Expand All @@ -90,7 +90,7 @@ service nats:Service on new nats:Listener(nats:DEFAULT_URL) {
service nats:Service on new nats:Listener(nats:DEFAULT_URL) {

// The returned message will be published to the replyTo subject of the consumed message
remote function onRequest(nats:Message message) returns string? {
remote function onRequest(nats:AnydataMessage message) returns string? {
return "Reply Message";
}
}
Expand Down
2 changes: 1 addition & 1 deletion ballerina-tests/Ballerina.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[package]
org = "ballerinax"
name = "nats_tests"
version = "2.11.0"
version = "3.0.0"
4 changes: 2 additions & 2 deletions ballerina-tests/Dependencies.toml
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ dependencies = [
[[package]]
org = "ballerinax"
name = "nats"
version = "2.11.0"
version = "3.0.0"
scope = "testOnly"
dependencies = [
{org = "ballerina", name = "crypto"},
Expand All @@ -158,7 +158,7 @@ modules = [
[[package]]
org = "ballerinax"
name = "nats_tests"
version = "2.11.0"
version = "3.0.0"
dependencies = [
{org = "ballerina", name = "lang.runtime"},
{org = "ballerina", name = "lang.string"},
Expand Down
2 changes: 1 addition & 1 deletion ballerina-tests/tests/data_binding_publish_tests.bal
Original file line number Diff line number Diff line change
Expand Up @@ -619,7 +619,7 @@ service nats:Service on new nats:Listener(DATA_BINDING_URL) {
remote function onMessage(XmlMessage msg) {
}

remote function onError(nats:Message message, nats:Error err) {
remote function onError(nats:AnydataMessage message, nats:Error err) {
log:printInfo("Error Received: " + err.message());
setOnErrorReceived(true);
setOnErrorMessage(err.message());
Expand Down
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 = "nats"
version = "2.11.0"
version = "3.0.0"
authors = ["Ballerina"]
keywords = ["service", "client", "messaging", "network", "pubsub"]
repository = "https://github.com/ballerina-platform/module-ballerinax-nats"
Expand All @@ -18,8 +18,8 @@ path = "./lib/jnats-2.16.0.jar"
[[platform.java17.dependency]]
groupId = "io.ballerina.stdlib"
artifactId = "nats-native"
version = "2.11.0"
path = "../native/build/libs/nats-native-2.11.0-SNAPSHOT.jar"
version = "3.0.0"
path = "../native/build/libs/nats-native-3.0.0-SNAPSHOT.jar"

[[platform.java17.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 = "nats-compiler-plugin"
class = "io.ballerina.stdlib.nats.plugin.NatsCompilerPlugin"

[[dependency]]
path = "../compiler-plugin/build/libs/nats-compiler-plugin-2.11.0-SNAPSHOT.jar"
path = "../compiler-plugin/build/libs/nats-compiler-plugin-3.0.0-SNAPSHOT.jar"
2 changes: 1 addition & 1 deletion ballerina/Dependencies.toml
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ modules = [
[[package]]
org = "ballerinax"
name = "nats"
version = "2.11.0"
version = "3.0.0"
dependencies = [
{org = "ballerina", name = "constraint"},
{org = "ballerina", name = "crypto"},
Expand Down
6 changes: 3 additions & 3 deletions ballerina/Module.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ nats:Error? result =
2. Publish as a request that expects a reply:
```ballerina
string message = "hello world";
nats:Message|nats:Error reqReply =
nats:AnydataMessage|nats:Error reqReply =
natsClient->requestMessage({ content: message.toBytes(), subject: "demo.nats.basic"}, 5);
```

Expand All @@ -69,7 +69,7 @@ nats:Error? result = natsClient->publish({ content: message.toBytes(), subject:
}
service nats:Service on new nats:Listener(nats:DEFAULT_URL) {

remote function onMessage(nats:Message message) {
remote function onMessage(nats:AnydataMessage message) {
}
}
```
Expand All @@ -83,7 +83,7 @@ service nats:Service on new nats:Listener(nats:DEFAULT_URL) {
service nats:Service on new nats:Listener(nats:DEFAULT_URL) {

// The returned message will be published to the replyTo subject of the consumed message
remote function onRequest(nats:Message message) returns string? {
remote function onRequest(nats:AnydataMessage message) returns string? {
return "Reply Message";
}
}
Expand Down
6 changes: 3 additions & 3 deletions ballerina/Package.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ nats:Error? result =
2. Publish as a request that expects a reply:
```ballerina
string message = "hello world";
nats:Message|nats:Error reqReply =
nats:AnydataMessage|nats:Error reqReply =
natsClient->requestMessage({ content: message.toBytes(), subject: "demo.nats.basic"}, 5);
```

Expand All @@ -69,7 +69,7 @@ nats:Error? result = natsClient->publish({ content: message.toBytes(), subject:
}
service nats:Service on new nats:Listener(nats:DEFAULT_URL) {

remote function onMessage(nats:Message message) {
remote function onMessage(nats:AnydataMessage message) {
}
}
```
Expand All @@ -83,7 +83,7 @@ service nats:Service on new nats:Listener(nats:DEFAULT_URL) {
service nats:Service on new nats:Listener(nats:DEFAULT_URL) {

// The returned message will be published to the replyTo subject of the consumed message
remote function onRequest(nats:Message message) returns string? {
remote function onRequest(nats:AnydataMessage message) returns string? {
return "Reply Message";
}
}
Expand Down
14 changes: 0 additions & 14 deletions ballerina/records.bal
Original file line number Diff line number Diff line change
Expand Up @@ -109,20 +109,6 @@ public type RetryConfig record {|
decimal connectionTimeout = 2;
|};

# Represents the message, which a NATS server sends to its subscribed services.
#
# + content - The message content
# + replyTo - The `replyTo` subject of the message
# + subject - The subject to which the message was sent to
# # Deprecated
# This record is deprecated. Use `AnydataMessage` record instead.
@deprecated
public type Message record {|
byte[] content;
string subject;
string replyTo?;
|};

# Represents the anydata message, which a NATS server sends to its subscribed services.
#
# + content - The message content, which can of type anydata
Expand Down
6 changes: 6 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ This file contains all the notable changes done to the Ballerina NATS package th

### Changed

- [[#6282] Remove the definition and the usages of the deprecated `nats:Message` record](https://github.com/ballerina-platform/ballerina-library/issues/6282)

## [2.10.0] - 2023-09-18

### Changed

- [[#4733] Changed disallowing service level annotations in the compiler plugin](https://github.com/ballerina-platform/ballerina-standard-library/issues/4733)

## [2.7.0] - 2023-04-10
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ listener nats:Listener subscription = new(nats:DEFAULT_URL);
}
service nats:Service on subscription {

remote function onRequest(nats:Message msg) returns nats:Client|error {
remote function onRequest(nats:AnydataMessage msg) returns nats:Client|error {
return new nats:Client(nats:DEFAULT_URL);
}
}
Expand All @@ -33,7 +33,7 @@ service nats:Service on subscription {
}
service nats:Service on subscription {

remote function onRequest(nats:Message msg) returns nats:Listener {
remote function onRequest(nats:AnydataMessage msg) returns nats:Listener {
return subscription;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ listener nats:Listener subscription = new(nats:DEFAULT_URL);
}
service nats:Service on subscription {

remote function onMessage(nats:Message message) {
remote function onMessage(nats:AnydataMessage message) {
}

remote function onError(string message, nats:Error err) {
Expand All @@ -35,7 +35,7 @@ service nats:Service on subscription {
}
service nats:Service on subscription {

remote function onMessage(nats:Message message) {
remote function onMessage(nats:AnydataMessage message) {
}

remote function onError(nats:Client message, nats:Error err) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ listener nats:Listener subscription = new(nats:DEFAULT_URL);
}
service nats:Service on subscription {

remote function onMessage(nats:Message message) {
remote function onMessage(nats:AnydataMessage message) {
}

remote function onError(nats:Message message) {
remote function onError(nats:AnydataMessage message) {
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ listener nats:Listener subscription = new(nats:DEFAULT_URL);
}
service nats:Service on subscription {

remote function onMessage(nats:Message message) {
remote function onMessage(nats:AnydataMessage message) {
}

remote function onError(nats:Message message, nats:Error err, string something) {
remote function onError(nats:AnydataMessage message, nats:Error err, string something) {
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ listener nats:Listener subscription = new(nats:DEFAULT_URL);
}
service nats:Service on subscription {

remote function onMessage(nats:Message message) {
remote function onMessage(nats:AnydataMessage message) {
}

remote function onError(nats:Message message, string err) {
remote function onError(nats:AnydataMessage message, string err) {
}
}

Expand All @@ -35,9 +35,9 @@ service nats:Service on subscription {
}
service nats:Service on subscription {

remote function onMessage(nats:Message message) {
remote function onMessage(nats:AnydataMessage message) {
}

remote function onError(nats:Message message, nats:Client err) {
remote function onError(nats:AnydataMessage message, nats:Client err) {
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ listener nats:Listener subscription2 = new(nats:DEFAULT_URL);
}
service nats:Service on subscription1, subscription2 {

remote function onMessage(nats:Message message) {
remote function onMessage(nats:AnydataMessage message) {
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ listener nats:Listener subscription1 = new(nats:DEFAULT_URL);
}
service nats:Service on subscription1 {

remote function onMessage(nats:Message message) {
remote function onMessage(nats:AnydataMessage message) {
}

resource function get greeting() returns string {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ listener nats:Listener subscription = new(nats:DEFAULT_URL);
}
service nats:Service on subscription {

remote function onMessage(readonly & nats:Message message, string data) {
remote function onMessage(readonly & nats:AnydataMessage message, string data) {
}

remote function onError() {
Expand All @@ -36,10 +36,10 @@ service nats:Service on subscription {
}
service nats:Service on subscription {

remote function onMessage(nats:Message message, xml data) {
remote function onMessage(nats:AnydataMessage message, xml data) {
}

remote function onError(nats:Message message) {
remote function onError(nats:AnydataMessage message) {
}
}

Expand All @@ -48,7 +48,7 @@ service nats:Service on subscription {
}
service nats:Service on subscription {

remote function onMessage(readonly & nats:Message message, decimal[] data) {
remote function onMessage(readonly & nats:AnydataMessage message, decimal[] data) {
}

remote function onError(error err) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ listener nats:Listener subscription = new(nats:DEFAULT_URL);
}
service nats:Service on subscription {

remote function onMessage(string data, nats:Message message) {
remote function onMessage(string data, nats:AnydataMessage message) {
}

remote function onError(nats:Message message, nats:Error err) {
remote function onError(nats:AnydataMessage message, nats:Error err) {
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ import ballerinax/nats;
}
service nats:Service on new nats:Listener(nats:DEFAULT_URL) {

remote function onMessage(nats:Message message) {
remote function onMessage(nats:AnydataMessage message) {
}

remote function onRequest(nats:Message message) returns string {
remote function onRequest(nats:AnydataMessage message) returns string {
return "Hello";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ listener nats:Listener subscription = new(nats:DEFAULT_URL);
}
service nats:Service on subscription {

remote function onRequest(nats:Message message, string data) returns string? {
remote function onRequest(nats:AnydataMessage message, string data) returns string? {
return "Hello from the other side";
}

Expand All @@ -40,7 +40,7 @@ service nats:Service on subscription {
remote function onRequest(xml data) returns error? {
}

remote function onError(nats:Message message) {
remote function onError(nats:AnydataMessage message) {
}
}

Expand All @@ -49,7 +49,7 @@ service nats:Service on subscription {
}
service nats:Service on subscription {

remote function onRequest(readonly & nats:Message message, decimal[] data) returns anydata {
remote function onRequest(readonly & nats:AnydataMessage message, decimal[] data) returns anydata {
return "Received decimal value";
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ service nats:Service on subscription {
remote function onRequest(string data, xml message) returns error? {
}

remote function onError(nats:Message message, nats:Error err) returns error? {
remote function onError(nats:AnydataMessage message, nats:Error err) returns error? {
}
}

Expand All @@ -39,7 +39,7 @@ service nats:Service on subscription {
remote function onRequest(json[] data, int message) returns error? {
}

remote function onError(nats:Message message, nats:Error err) returns error? {
remote function onError(nats:AnydataMessage message, nats:Error err) returns error? {
}
}

Expand All @@ -51,6 +51,6 @@ service nats:Service on subscription {
remote function onRequest(readonly & byte[] data, int message) returns error? {
}

remote function onError(nats:Message message, nats:Error err) returns error? {
remote function onError(nats:AnydataMessage message, nats:Error err) returns error? {
}
}
Loading
Loading