|
| 1 | +// Copyright (c) 2021 WSO2 Inc. (http://www.wso2.org) All Rights Reserved. |
| 2 | +// |
| 3 | +// WSO2 Inc. licenses this file to you under the Apache License, |
| 4 | +// Version 2.0 (the "License"); you may not use this file except |
| 5 | +// in compliance with the License. |
| 6 | +// You may obtain a copy of the License at |
| 7 | +// |
| 8 | +// http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | +// |
| 10 | +// Unless required by applicable law or agreed to in writing, |
| 11 | +// software distributed under the License is distributed on an |
| 12 | +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 13 | +// KIND, either express or implied. See the License for the |
| 14 | +// specific language governing permissions and limitations |
| 15 | +// under the License. |
| 16 | + |
| 17 | +import ballerina/websubhub; |
| 18 | + |
| 19 | +@websubhub:ServiceConfig { |
| 20 | + autoVerifySubscription: true |
| 21 | +} |
| 22 | +service /websubhub on new websubhub:Listener(9090) { |
| 23 | + isolated remote function onRegisterTopic(websubhub:TopicRegistration message, websubhub:Controller hubController) |
| 24 | + returns websubhub:TopicRegistrationSuccess { |
| 25 | + return websubhub:TOPIC_REGISTRATION_SUCCESS; |
| 26 | + } |
| 27 | + |
| 28 | + isolated remote function onDeregisterTopic(websubhub:TopicDeregistration message, websubhub:Controller hubController) |
| 29 | + returns websubhub:TopicDeregistrationSuccess { |
| 30 | + return websubhub:TOPIC_DEREGISTRATION_SUCCESS; |
| 31 | + } |
| 32 | + |
| 33 | + isolated remote function onUpdateMessage(websubhub:UpdateMessage msg, websubhub:Controller hubController) returns websubhub:Acknowledgement { |
| 34 | + return websubhub:ACKNOWLEDGEMENT; |
| 35 | + } |
| 36 | + |
| 37 | + isolated remote function onSubscriptionIntentVerified(websubhub:VerifiedSubscription msg, websubhub:Controller hubController) {} |
| 38 | + |
| 39 | + isolated remote function onUnsubscriptionIntentVerified(websubhub:VerifiedUnsubscription msg, websubhub:Controller hubController){} |
| 40 | +} |
0 commit comments