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

Implement websubhub:ServiceConfig annotation for websubhub:Service #96

Merged
merged 18 commits into from
Apr 20, 2021

Conversation

ayeshLK
Copy link
Member

@ayeshLK ayeshLK commented Apr 16, 2021

Purpose

$subject

Fixes 1253
Fixes 1249

Examples

  • Updated websubhub:ClientConfiguration which could be used for websubhub:HubClient / websubhub:PublisherClient is as follows.
public type ClientConfiguration record {|
    string httpVersion = HTTP_1_1;
    http:ClientHttp1Settings http1Settings = {};
    http:ClientHttp2Settings http2Settings = {};
    decimal timeout = 60;
    http:PoolConfiguration poolConfig?;
    http:RetryConfig retryConfig?;
    http:ResponseLimitConfigs responseLimits = {};
    http:ClientSecureSocket secureSocket?;
    http:CircuitBreakerConfig circuitBreaker?;
|};
  • websubhub:ServiceConfig is an optional annotation configuration which could be included to websubhub:Service declaration. Following is a sample on how to use the websubhub:ServiceConfig. leaseSeconds parameter is used to identify the subscription deactivation. webHookConfig is used for underlying http:Client used for subscription and unsubscription verification.
@websubhub:ServiceConfig {
    leaseSeconds: 86400,
    webHookConfig: {
        secureSocket: {
            cert: {
                path: "tests/resources/ballerinaTruststore.pkcs12",
                password: "ballerina"
            }
        }
    }
}
service /websubhub on new Listener(9099) {
    isolated remote function onRegisterTopic(TopicRegistration message) returns TopicRegistrationSuccess {
        return TOPIC_REGISTRATION_SUCCESS;
    }
    // implement other service methods
}

Checklist

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

@codecov
Copy link

codecov bot commented Apr 16, 2021

Codecov Report

Merging #96 (3756a07) into main (0ea6c0b) will increase coverage by 5.13%.
The diff coverage is 97.43%.

Impacted file tree graph

@@             Coverage Diff              @@
##               main      #96      +/-   ##
============================================
+ Coverage     75.61%   80.75%   +5.13%     
- Complexity       13       14       +1     
============================================
  Files            10       11       +1     
  Lines           771      800      +29     
  Branches        430      436       +6     
============================================
+ Hits            583      646      +63     
+ Misses          188      154      -34     
Impacted Files Coverage Δ Complexity Δ
websubhub-ballerina/hub_listener.bal 86.36% <91.66%> (+1.06%) 0.00 <0.00> (ø)
websubhub-ballerina/annotation.bal 100.00% <100.00%> (ø) 0.00 <0.00> (?)
websubhub-ballerina/commons.bal 89.83% <100.00%> (+5.73%) 0.00 <0.00> (ø)
websubhub-ballerina/http_service.bal 82.01% <100.00%> (+12.16%) 0.00 <0.00> (ø)
websubhub-ballerina/hub_client.bal 85.82% <100.00%> (ø) 0.00 <0.00> (ø)
websubhub-ballerina/publisher_client.bal 79.85% <100.00%> (+1.43%) 0.00 <0.00> (ø)
websubhub-ballerina/utils.bal 74.16% <100.00%> (+5.00%) 0.00 <0.00> (ø)
... and 4 more

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 0ea6c0b...3756a07. Read the comment docs.

@ayeshLK ayeshLK changed the title Include websubhub:ServiceConfig annotation configuration for websubhub:Service Implement websubhub:ServiceConfig annotation for websubhub:Service Apr 17, 2021
Copy link
Member

@ldclakmal ldclakmal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@shafreenAnfar shafreenAnfar merged commit 2ee27a7 into ballerina-platform:main Apr 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants