Skip to content

Commit

Permalink
Merge pull request #553 from ballerina-platform/listener-config
Browse files Browse the repository at this point in the history
Make listener configuration as an included parameter
  • Loading branch information
TharmiganK authored Jan 28, 2025
2 parents 816587e + 19c85d6 commit 1f45bfa
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 19 deletions.
2 changes: 1 addition & 1 deletion ballerina/Dependencies.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

[ballerina]
dependencies-toml-version = "2"
distribution-version = "2201.11.0-20241121-075100-c4c87cbc"
distribution-version = "2201.11.0-20250127-101700-a4b67fe5"

[[package]]
org = "ballerina"
Expand Down
2 changes: 1 addition & 1 deletion ballerina/service_endpoint.bal
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public isolated class Listener {
# Creates a new Directory listener.
#
# + listenerConfig - The `ListenerConfig` record with the directory details
public isolated function init(ListenerConfig listenerConfig) returns error? {
public isolated function init(*ListenerConfig listenerConfig) returns error? {
self.config = listenerConfig.cloneReadOnly();
return initEndpoint(self);
}
Expand Down
24 changes: 12 additions & 12 deletions ballerina/tests/directory-listener-test.bal
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ import ballerina/test;
import ballerina/lang.runtime as runtime;
import ballerina/jballerina.java;

listener Listener localFolder = new ({
path: "tests/resources",
recursive: false
});
listener Listener localFolder = new (
path = "tests/resources",
recursive = false
);

boolean createInvoke = false;
boolean modifyInvoke = false;
Expand Down Expand Up @@ -76,10 +76,10 @@ function isDeleteInvoked() {
}
}

Listener|error localFolder1 = new ({
path: "tests/test",
recursive: false
});
Listener|error localFolder1 = new (
path = "tests/test",
recursive = false
);

@test:Config {}
function testDirectoryNotExist() {
Expand Down Expand Up @@ -122,10 +122,10 @@ function testNotDirectory() {
}


Listener|error localFolder5 = new ({
path: "tests/resources",
recursive: false
});
Listener|error localFolder5 = new (
path = "tests/resources",
recursive = false
);

Service attachService = service object {
};
Expand Down
4 changes: 4 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Changed

- [Change the listener configuration as an included parameter](https://github.com/ballerina-platform/ballerina-library/issues/7494)

## [1.10.0] - 2024-08-20

### Changed
Expand Down
6 changes: 1 addition & 5 deletions examples/file-management-system/observer/file_manager.bal
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,7 @@ configurable string toAddress = ?;
// Create the email client.
final email:SmtpClient smtpClient = check new (host, username , password, port = port);

listener file:Listener inFolder = new ({
path: directoryPath
});

isolated service "fileObserver" on inFolder {
isolated service "fileObserver" on new file:Listener(path = directoryPath) {

isolated remote function onCreate(file:FileEvent m) {
sendEmail("New File Created", "Created file path: " + m.name);
Expand Down

0 comments on commit 1f45bfa

Please sign in to comment.