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

readonly support for the parameters of remote methods #500

Merged
merged 8 commits into from
Jan 25, 2022

Conversation

ayeshLK
Copy link
Member

@ayeshLK ayeshLK commented Jan 25, 2022

Purpose

$subject

Related to #2604

Examples

With this change developers could use reaonly parameters for remote methods in websub:SubscriberService:

@SubscriberServiceConfig {
    target: "https://discover.hub/discovery",
    leaseSeconds: 36000
}
service /subscriber on subListener {
    isolated remote function onSubscriptionValidationDenied(readonly & websub:SubscriptionDeniedError msg) returns websub:Acknowledgement? {
        // implement logic here
        return websub:ACKNOWLEDGEMENT;
    }

    remote function onUnsubscriptionVerification(readonly & websub:UnsubscriptionVerification msg)
                    returns websub:UnsubscriptionVerificationSuccess|websub:UnsubscriptionVerificationError {
        if (msg.hubTopic == "test1") {
            return websub:UNSUBSCRIPTION_VERIFICATION_ERROR;
        } else {
            return websub:UNSUBSCRIPTION_VERIFICATION_SUCCESS;
        }
    }

    isolated remote function onSubscriptionVerification(readonly & websub:SubscriptionVerification msg)
                        returns websub:SubscriptionVerificationSuccess|websub:SubscriptionVerificationError {
        if (msg.hubTopic == "test1") {
            return websub:SUBSCRIPTION_VERIFICATION_ERROR;
        } else {
            return websub:SUBSCRIPTION_VERIFICATION_SUCCESS;
        }
    }

    isolated remote function onEventNotification(readonly & websub:ContentDistributionMessage event)
                        returns websub:Acknowledgement|websub:SubscriptionDeletedError? {
        // implement logic here
        return websub:ACKNOWLEDGEMENT;
    }
}

Checklist

  • Linked to an issue
  • Updated the changelog
  • Added tests

@ayeshLK ayeshLK requested a review from HindujaB January 25, 2022 11:15
@codecov
Copy link

codecov bot commented Jan 25, 2022

Codecov Report

Merging #500 (57fac57) into master (60e38ea) will increase coverage by 2.48%.
The diff coverage is 89.47%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #500      +/-   ##
==========================================
+ Coverage   80.28%   82.77%   +2.48%     
==========================================
  Files          16       16              
  Lines         695      714      +19     
  Branches      364      370       +6     
==========================================
+ Hits          558      591      +33     
+ Misses        131      115      -16     
- Partials        6        8       +2     
Impacted Files Coverage Δ
...erina/stdlib/websub/NativeHttpToWebsubAdaptor.java 88.00% <89.47%> (+7.35%) ⬆️
ballerina/http_service.bal 91.66% <0.00%> (+0.92%) ⬆️
ballerina/commons.bal 100.00% <0.00%> (+4.16%) ⬆️
ballerina/native.bal 100.00% <0.00%> (+11.11%) ⬆️
ballerina/request_processor.bal 86.04% <0.00%> (+12.79%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 60e38ea...57fac57. Read the comment docs.

@ayeshLK ayeshLK changed the title reaonly support for the parameters of remote methods readonly support for the parameters of remote methods Jan 25, 2022
@shafreenAnfar shafreenAnfar merged commit a2f1674 into ballerina-platform:master Jan 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants