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

KOGITO-3042: Replace MessageBusClient with proxified version of ApiToConsume #250

Merged
merged 9 commits into from
Aug 17, 2020

Conversation

tiagobento
Copy link
Contributor

Consuming the API provided by your counterpart as an Envelope or a Channel is not very complex, but making it be type-safe makes things way more complicated. This PR makes it possible to consume your counterpart APIs by using an object with the same interface that it implements. This was achieved by using a Proxy object. See EnvelopeBusMessageManager.ts.

I believe this is a much better way to communicate with the Envelope/Channel APIs than we had before, although just as type-safe.

I also provided a convenient messageBusClientApiMock function to be used by tests.

Copy link
Contributor

@caponetto caponetto left a comment

Choose a reason for hiding this comment

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

Top!

@tiagobento
Copy link
Contributor Author

tiagobento commented Aug 12, 2020

@caponetto Decided to remove the KogitoEditorEnvelopeServer too, since the way to call the Envelope API is now much better.

Had to make the Proxy objects for requests and notifications a little bit more complex, since we need to spy on those methods on some of our tests (EmbeddedEditor.test.tsx). I needed to memoize the values returned by the get handlers and add a set handler, since that's what jest.spyOn needs internally.

This has made the "proxied" objects behave much more like a normal object, too :)

Take a look at e4ee88c

EDIT: Oops, had to add a new commit to fix tests.

@tiagobento tiagobento changed the title KOGITO-3042: Replace MessageBusClient<> with proxified version of ApiToConsume KOGITO-3042: Replace MessageBusClient with proxified version of ApiToConsume Aug 13, 2020
Copy link
Contributor

@ljmotta ljmotta left a comment

Choose a reason for hiding this comment

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

LGTM! 🚀

Copy link
Contributor

@tomasdavidorg tomasdavidorg left a comment

Choose a reason for hiding this comment

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

Looks good to me.

@ederign ederign merged commit 0d81983 into apache:master Aug 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants