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 #1253

Closed
ayeshLK opened this issue Apr 17, 2021 · 0 comments · Fixed by ballerina-platform/module-ballerina-websubhub#96
Labels
module/websubhub Issues related to Ballerina websubhub module Team/PCM Protocol connector packages related issues Type/Improvement Verson/SwanLakeDump All issues planned for Swan Lake GA release

Comments

@ayeshLK
Copy link
Member

ayeshLK commented Apr 17, 2021

Description:

Implement websubhub:ServiceConfig annotation which could be used to provide additional configurations for websubhub:Service.

Describe your problem(s)

Developers should be able to pass leaseSeconds parameter to websubhub:Service to implement a subscription timeout.
Developers should be able to pass additional websubhub:ClientConfiguration to underlying http:Client which is used to verify the intent of subscriptions / unsubscriptions.

Describe your solution(s)

Implement a service annotation for websubhub:Service which could be used to pass required additional configurations.

Samples

  • 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 and webHookConfig parameters in websubhub:ServiceConfig are also optional parameters.
@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
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module/websubhub Issues related to Ballerina websubhub module Team/PCM Protocol connector packages related issues Type/Improvement Verson/SwanLakeDump All issues planned for Swan Lake GA release
Projects
None yet
2 participants