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

Generated unique-service-path should not be changed after compilation #1813

Closed
4 tasks done
ayeshLK opened this issue Aug 26, 2021 · 5 comments · Fixed by ballerina-platform/module-ballerina-websub#359
Closed
4 tasks done
Assignees
Labels

Comments

@ayeshLK
Copy link
Member

ayeshLK commented Aug 26, 2021

Description:
In websub:SubscriberService we would generate a unique, random service path if the service path is not specified by the user. But currently generated service path is dynamic and it will change time to time when we stop and restart the websub:SubscriberService.

Solution
It would be better if we could generate this at compile-time and cache it. Then we could use it whenever we run the service and the service-path will not change when ever we re-start the service.

Describe your task(s)
We would implement this feature by writing compile-time generated service-path to service-info.csv file and packing it to ballerina executable jar. Then we would use this information at runtime to bind the websub:SubscriberService to generated service-path.

  • Improve WebSub compiler plugin to generate service-info.csv file and pack it to executable jar.
    • Generate unique-service path and add that information to service-info.csv file.
    • Pack generated service-info.csv file into ballerina executable jar.
  • Read service-info.csv file at runtime and attach websub:SubscriberService to generated service-path if user has not provided service path information.
@ayeshLK
Copy link
Member Author

ayeshLK commented Aug 26, 2021

We will pack service-info.txt file into ballerina executable jar according to following structure:

├── target/bin
│   ├-- service.jar
│   │   └── resources
│   │       └── ballerina
│   │           └── websub
│   │               └── service-info.txt

@shafreenAnfar
Copy link
Contributor

This is good let's go ahead.

@ayeshLK
Copy link
Member Author

ayeshLK commented Aug 30, 2021

Since we there could be scenarios where developer could implement multiple-subscriber services in one ballerina project, we might need to provide information to identify which service-path for which service. Hence, service-info.txt will contain CSV and file name will be changed to service-info.csv.

@shafreenAnfar WDYT ?

@ayeshLK ayeshLK added Points/3 and removed Points/2 labels Aug 30, 2021
@shafreenAnfar
Copy link
Contributor

Isn't this problem the same as the problem we had in HTTP implementation ?

@ayeshLK
Copy link
Member Author

ayeshLK commented Aug 30, 2021

Yes, that is why we need to use this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
2 participants