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

feat: fixes for subscriber and publisher semantics #164

Merged
merged 6 commits into from
Feb 11, 2023

Conversation

emilianozublena
Copy link
Member

@emilianozublena emilianozublena commented Jan 16, 2023

Description

This PR changes how code is generated. It'll change which channels are "introduced" in our Publisher and Subscriber classes. With this PR the final class Publisher will actually be loaded with operations/channels described as "subscribe" in the AsyncAPI file, and the same happens the other way around, the final class Subscriber will be loaded with operations/channels described as "publish" in the AsyncAPI file.
There's an extra change i've introduced which i don't think it deserved a standalone PR (but if anyone else thinks it does, happy to do it) which is removing once and for all the legacy naming of the init class that fires the factory and returns the Publisher/Subscriber classes. Initially it was called "BrokerAPI" which is the name i gave it before donating the template to the AsyncAPI Initiative, right now that doesn't make any sense and it creates noises. That class was changed to AsyncAPI and same goes for the tests it had around it.

Motivation and context

This was a required change in order to be able to publish this template, basically because i had a confusion on the semantics (which is something common and AsyncAPI v3 aims to solve it once and for all) and the template was actually being generated from a "server-side" kinda perspective. Right now its inline with what the spec always meant, which is a client perspective.
This is part of a broader topic as the confusion was kind of general across the AsyncAPI community as stated in several gh issues like this one: asyncapi/spec#520
Hopefully, whenever we reach to v3, this will get solved and we might need to do another update to the template (and prbly part ways in terms of versions where v2 specs will continue working w this version and v3 specs will work with a new one, hopefully with the React template engine as well). Here's the gh issue for async api v3: asyncapi/spec#618

How has this been tested?

Covered by some of the Unit Tests we already have as well as the running examples the bash script under utilities generates (by using a local rabbit mq instance). Though we need to pump up tests for sure

Screenshots (if appropriate)

Types of changes

What types of changes does your code introduce? Put an x in all the boxes that apply:

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

Go over all the following points, and put an x in all the boxes that apply.

Please, please, please, don't send your pull request until all of the boxes are ticked. Once your pull request is created, it will trigger a build on our continuous integration server to make sure your tests and code style pass.

  • I have read the CONTRIBUTING document.
  • My pull request addresses exactly one patch/feature.
  • I have created a branch for this patch/feature.
  • Each individual commit in the pull request is meaningful.
  • I have added tests to cover my changes.
  • If my change requires a change to the documentation, I have updated it accordingly.

If you're unsure about any of these, don't hesitate to ask. We're here to help!

…ow the publisher template class takes data from the spec where the definition is subscriber and the same the other way around. Prbly for v3 this will need to change again, as the semantis discussion is still in place
@emilianozublena emilianozublena changed the title Changes for subscriber and publisher concepts refactor: Changes for subscriber and publisher concepts Jan 16, 2023
@emilianozublena emilianozublena changed the title refactor: Changes for subscriber and publisher concepts refactor: refactor for subscriber and publisher semantics Jan 16, 2023
@emilianozublena emilianozublena changed the title refactor: refactor for subscriber and publisher semantics refactor: fixes for subscriber and publisher semantics Jan 16, 2023
…ut a spec and generated code. This will come in handy whenever we swtich to the ReactJS template engine
…ckslash as native classes on PHP are safer to import using that, otherwise there might be issues with namespaces if the package is introduced on something else than the root namespace
@emilianozublena emilianozublena changed the title refactor: fixes for subscriber and publisher semantics feat: fixes for subscriber and publisher semantics Jan 18, 2023
@derberg
Copy link
Member

derberg commented Jan 31, 2023

@emilianozublena release PR merged. You just need to solve some conflicts here

@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@emilianozublena
Copy link
Member Author

/rtm

@asyncapi-bot asyncapi-bot merged commit 02e406b into master Feb 11, 2023
@asyncapi-bot asyncapi-bot deleted the changes_for_subscriber_and_publisher_concepts branch February 11, 2023 19:30
@asyncapi-bot
Copy link
Contributor

🎉 This PR is included in version 0.1.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Successfully merging this pull request may close these issues.

3 participants