-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #262 from ballerina-platform/fix-issues
Allow `onComplete` method for MQTT service declaration
- Loading branch information
Showing
15 changed files
with
317 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
compiler-plugin-tests/src/test/resources/ballerina_sources/invalid_service_15/Ballerina.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
[package] | ||
org = "kafka_test" | ||
name = "invalid_service_15" | ||
version = "0.1.0" |
40 changes: 40 additions & 0 deletions
40
compiler-plugin-tests/src/test/resources/ballerina_sources/invalid_service_15/service.bal
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// Copyright (c) 2025 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/mqtt; | ||
import ballerina/uuid; | ||
|
||
mqtt:ListenerConfiguration listenerConfiguration = { | ||
connectionConfig: { | ||
username: "ballerina", | ||
password: "ballerinamqtt" | ||
}, | ||
manualAcks: false | ||
}; | ||
|
||
listener mqtt:Listener mqttSubscriber = check new (mqtt:DEFAULT_URL, uuid:createType1AsString(), "mqtt/test", listenerConfiguration); | ||
|
||
service on mqttSubscriber { | ||
|
||
private final string var1 = "Mqtt Service"; | ||
private final int var2 = 54; | ||
|
||
remote function onMessage(mqtt:Message message) returns mqtt:Error? { | ||
} | ||
|
||
remote function onComplete(record{} token) { | ||
} | ||
} |
4 changes: 4 additions & 0 deletions
4
compiler-plugin-tests/src/test/resources/ballerina_sources/invalid_service_16/Ballerina.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
[package] | ||
org = "kafka_test" | ||
name = "invalid_service_16" | ||
version = "0.1.0" |
40 changes: 40 additions & 0 deletions
40
compiler-plugin-tests/src/test/resources/ballerina_sources/invalid_service_16/service.bal
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// Copyright (c) 2025 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/mqtt; | ||
import ballerina/uuid; | ||
|
||
mqtt:ListenerConfiguration listenerConfiguration = { | ||
connectionConfig: { | ||
username: "ballerina", | ||
password: "ballerinamqtt" | ||
}, | ||
manualAcks: false | ||
}; | ||
|
||
listener mqtt:Listener mqttSubscriber = check new (mqtt:DEFAULT_URL, uuid:createType1AsString(), "mqtt/test", listenerConfiguration); | ||
|
||
service on mqttSubscriber { | ||
|
||
private final string var1 = "Mqtt Service"; | ||
private final int var2 = 54; | ||
|
||
remote function onMessage(mqtt:Message message) returns mqtt:Error? { | ||
} | ||
|
||
remote function onComplete(mqtt:DeliveryToken token, record{} data) { | ||
} | ||
} |
4 changes: 4 additions & 0 deletions
4
compiler-plugin-tests/src/test/resources/ballerina_sources/invalid_service_17/Ballerina.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
[package] | ||
org = "kafka_test" | ||
name = "invalid_service_17" | ||
version = "0.1.0" |
40 changes: 40 additions & 0 deletions
40
compiler-plugin-tests/src/test/resources/ballerina_sources/invalid_service_17/service.bal
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// Copyright (c) 2025 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/mqtt; | ||
import ballerina/uuid; | ||
|
||
mqtt:ListenerConfiguration listenerConfiguration = { | ||
connectionConfig: { | ||
username: "ballerina", | ||
password: "ballerinamqtt" | ||
}, | ||
manualAcks: false | ||
}; | ||
|
||
listener mqtt:Listener mqttSubscriber = check new (mqtt:DEFAULT_URL, uuid:createType1AsString(), "mqtt/test", listenerConfiguration); | ||
|
||
service on mqttSubscriber { | ||
|
||
private final string var1 = "Mqtt Service"; | ||
private final int var2 = 54; | ||
|
||
remote function onMessage(mqtt:Message message) returns mqtt:Error? { | ||
} | ||
|
||
remote function onComplete() { | ||
} | ||
} |
4 changes: 4 additions & 0 deletions
4
compiler-plugin-tests/src/test/resources/ballerina_sources/valid_service_8/Ballerina.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
[package] | ||
org = "kafka_test" | ||
name = "valid_service_08" | ||
version = "0.1.0" |
61 changes: 61 additions & 0 deletions
61
compiler-plugin-tests/src/test/resources/ballerina_sources/valid_service_8/service.bal
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
// Copyright (c) 2025 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/mqtt; | ||
import ballerina/uuid; | ||
|
||
mqtt:ListenerConfiguration listenerConfiguration = { | ||
connectionConfig: { | ||
username: "ballerina", | ||
password: "ballerinamqtt" | ||
}, | ||
manualAcks: false | ||
}; | ||
|
||
listener mqtt:Listener mqttSubscriber = check new (mqtt:DEFAULT_URL, uuid:createType1AsString(), "mqtt/test", listenerConfiguration); | ||
|
||
@display { | ||
label: "mqttService1" | ||
} | ||
service on mqttSubscriber { | ||
remote function onMessage(mqtt:Message message) returns mqtt:Error? { | ||
} | ||
|
||
remote function onComplete(mqtt:DeliveryToken token) returns mqtt:Error? { | ||
} | ||
} | ||
|
||
@display { | ||
label: "mqttService2" | ||
} | ||
service on mqttSubscriber { | ||
remote function onMessage(mqtt:Message message) returns error? { | ||
} | ||
|
||
remote function onComplete(mqtt:DeliveryToken token) returns error? { | ||
} | ||
} | ||
|
||
@display { | ||
label: "mqttService3" | ||
} | ||
service on mqttSubscriber { | ||
remote function onMessage(mqtt:Message message) { | ||
} | ||
|
||
remote function onComplete(mqtt:DeliveryToken token) { | ||
} | ||
} |
Oops, something went wrong.