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

Migrate to RxJS 5 #15

Merged
merged 14 commits into from
Nov 8, 2016
Merged

Conversation

nfantone
Copy link

@nfantone nfantone commented Oct 29, 2016

Hi, @SkippyZA!

I'm the lead maintainer on seneca-amqp-transport and while looking for a way to enhance that module I thought of including RxJS for its API. I started rolling something of my own, but then, shortly after, I stumbled upon your amqplib wrapper and thought that it was just what I needed. So I built a little RPC module on top of it - but while doing so, I was depending on a local fork of rx-amqplib which included some updates here and there. And here it is.

This PR includes:

  • Migrate from rxjs4 to latest 5.0.0-rc1.
  • Add .editorconfig and yarn.lock files.
  • Remove dist/ and typings/ directories.
  • Extended .gitignore.
  • Update all typings and keep only those that were needed.
  • Some other minor improvements.

Our intention is to replace amqplib with rx-amqplib in our AMQP transport in the near future. We are currently using our internal fork for development and would be great to see at least some of these changes back merged to your library.

I realize this may be a lot for a single PR (though, most of it is just config changes), but the intention was just to share what I've done. You can take only the bits that interest you. Or don't! Totally up to you.

Also, we have a Travis script for building sources and creating the now gone dist/ directory (same goes for typings/). I didn't include it in the PR for obvious reasons. I see you plan on integrating CircleCI: you could accomplish the exact same thing we did using a circle.yml file or similar.

Thanks for your work on this! Was glad to find your module on npm and having some reliable leverage that kept me from starting from scratch.

@SkippyZA
Copy link
Owner

Hi @nfantone, thanks very much for taking your time to submit this. Having used Seneca with your library previously, it is pretty cool having you integrate my library.

Having had a quick look over the pull request you have made, you have covered a lot of issues that I have wanted to clean up.

Due to the fact that this PR requires the bump of RxJS from 4x to 5x, I will have this form part of a rx-amqplib v1 release, which I want to have out by early next week.

@nfantone
Copy link
Author

No need to rush this. Also, unit tests would be good to have for a major 1.0.0 release. I could give a hand on those, if you like.

@SkippyZA
Copy link
Owner

I agree fully with unit tests, and is already part of the plan. If you wish, another PR with unit tests would be greatly appreciated.

} catch (e) {
} // This prevents a race condition
this.cancel(tag)
.onErrorResumeNext(Observable.of(false));
Copy link
Author

Choose a reason for hiding this comment

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

@SkippyZA Not very sure on this change, TBH. Your try/catch is synchronous while this isn't, so I'm not exactly confident it'll swallow exceptions. I couldn't reproduce the "race condition" you mention on the comment.

An alternative is just to return false on the catch block.

@nfantone
Copy link
Author

Agreed. I'd say testing the API surface would suffice, for now. Since this is a wrapper, you don't need to test inner amqplib methods (i.e.: no need to test if a "channel" was created properly - just that a call to conn.createChannel() was reached).

@SkippyZA SkippyZA changed the base branch from master to develop-v1 November 2, 2016 07:17
Copy link
Owner

@SkippyZA SkippyZA left a comment

Choose a reason for hiding this comment

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

Thanks very much for your time and effort here. I have just updated the PR to pull against the v1 branch I am using for dev.

Could you please just update the .gitignore file, then I shall merge this in.

build/
node_modules/
### Typescript ###
dist/
Copy link
Owner

Choose a reason for hiding this comment

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

This is cool, but can you clear up the rest. I believe a .gitignore should only care about artifacts from project itself. IDE config files, OS files etc should be handled by the users own global .gitignore file.

Copy link
Author

@nfantone nfantone Nov 2, 2016

Choose a reason for hiding this comment

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

Really? Sure, no problem. But I really wouldn't rely on users' global settings. I'd rather have some extra harmless lines on a text file than making a contributor change his PR because he involuntary pushed some .Trash-343dsf or ~RxChannel.ts file.

Copy link
Owner

Choose a reason for hiding this comment

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

Ok cool, dont stress then.

Copy link
Author

@nfantone nfantone Nov 2, 2016

Choose a reason for hiding this comment

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

It's your call, though! I don't mind removing them, if you think it's cleaner.

@SkippyZA
Copy link
Owner

SkippyZA commented Nov 2, 2016

It seems there is a conflict with RxChannel.ts since I adjusted the branch too.

@nfantone
Copy link
Author

nfantone commented Nov 2, 2016

@SkippyZA You may want to put the release on hold for a moment. I've trying to push some things to make it easier to work with rx-amqplib.

@SkippyZA
Copy link
Owner

SkippyZA commented Nov 2, 2016

Great work with the other PRs @nfantone

Will merge this into the dev branch, but wont do a version bump yet.

@btipling
Copy link

btipling commented Nov 7, 2016

I'm very happy this PR exists. We've started using rxjs 5 and was just about to start my own fork but for now have pulled in nfantone's fork. If you need any help please let me know. Maybe I can spare some time and help get this PR merged or help in some other way. This is a great project. Thank you!

@nfantone
Copy link
Author

nfantone commented Nov 7, 2016

I don't really know what's needed to merge this. @SkippyZA rebased the merge to another branch and it conflicted.

Anyhow, I was working on updating things so as to avoid using typings and update to [email protected].

@SkippyZA
Copy link
Owner

SkippyZA commented Nov 7, 2016

Sorry gents, been slightly distracted with changing of jobs at the end of this month.

I switched this to develop-v1 as I don't want to merge directly into master until we have 0.5.0 of amqplib in. I have also had the intention of building a basic set of test and release it as a v1 build.

@nfantone
Copy link
Author

nfantone commented Nov 7, 2016

No worries, @SkippyZA.

The thing with updating to [email protected] is that the typings I sent to DT use Bluebird.Promise which, oddly enough, does not seem compatible with Promise exported by RxJS. I did not anticipate that, really.

I don't know what's the best solution here: update typings to use native PromiseLike or cast to <any> in rx-amqplib on every argument of every Observable method that expects a Promise. Neither makes me happy.

EDIT
Let's hope someone pays attention to this: DefinitelyTyped/DefinitelyTyped#12427 (comment)

EDIT 2
Problem seems to be in outdated Bluebird definitions for TS2: DefinitelyTyped/DefinitelyTyped#11036 (comment)

@SkippyZA SkippyZA merged commit abd7869 into SkippyZA:develop-v1 Nov 8, 2016
@cboden cboden mentioned this pull request Jan 8, 2020
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