-
Notifications
You must be signed in to change notification settings - Fork 106
Rough STOMP Adapter #212
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
base: master
Are you sure you want to change the base?
Rough STOMP Adapter #212
Conversation
d144a49
to
ac9e5fd
Compare
@chrismccord Thoughts? |
It would be nice if this could be done as an external adapter. Any thoughts on going that approach? |
Hey, @chrismccord. It shouldn't be too hard to extract it to it's own gem. I was actually going to suggest that we extract Faye, Pusher, and this adapter out to their own plugin projects after this iteration was complete. I think, though, that we need to solidify and maybe refactor a couple of the interface patterns used throughout the gem before we go down that route. Here are some thoughts:
This is very rough, and I won't speak to how accurate it is, but I think that it should be ironed out before trying to enable a conventions-based plugin architecture. Just a little bit of reorganization could go a long way.
Those are my most immediate general thoughts. I wouldn't mind working through some of these thoughts in a follow-up pull request or two, but I think it would be a bit much for me to take on by myself. I would like to see this PR get merged first so that it's integrations aren't lost in the mean time. After that, I'd love to collaborate on this, as I'm actively using this gem and kicking off it's usage in another project with this STOMP adapter. Sorry to dump so many thoughts on you, but drop your two cents in when you have a chance. It's definitely worth the time, so let me know. Cheers. |
@chrismccord is there anything I can do in the short-term to help get this merged? |
I understand there are some merge conflicts due to recent changes, but I'm still looking for general feedback on how to get this PR merged. @chrismccord or @ajb, feedback and advice for resolving merge conflicts, please? Thanks, cheers. |
Heya @aeberlin, Sorry for the delay. I'm onboard with a lot of your ideas in the long comment above. In fact, I'd like to try and outline a rough plan for the next major version of Anyway, I don't want to let that get in the way of this PR. This PR looks solid, and if you can resolve the merge conflicts, I can commit to taking the time to review & merge. |
Great, thanks @ajb. Will start working through the conflicts. |
494f89b
to
3f8b298
Compare
@ajb Think I've resolved all the conflicts cleanly. Please review when you have a chance. After looking over recent changes, I've noticed some similarities in the config keys for pusher and stomp, namely the websocket references. Do you have any thoughts on trying to generalize the Will check back after travis builds complete in case I missed something. Cheers. |
@ajb Please restart this job when you get a chance, issue doesn't look related to the changes. |
end | ||
end | ||
|
||
def debug_flag | ||
return config[:debug] unless config.fetch(:debug, nil).nil? | ||
defined?(::Rails) && !::Rails.env.production? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Care to explain this a bit? I don't think we're setting any configs automatically based on the Rails environment, so it might be best to just leave this as:
def debug_flag
config[:debug]
end
...unless I'm missing something?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nah, artifact of a legacy app I was testing this in. 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're not wrong, see my comment on the overall thread below. 👍
This looks great; just added a few inline comments above. Can you comment on some of the changes around the initialization, |
@ajb, With regards to the coffee initialization process, I think I can simplify it by requiring that sync dependencies be loaded explicitly, without auto-loading themselves. If we can require a minor breaking change which enables sync to initialize itself explicitly, instead of on require, initializing itself and binding to |
Overall reasoning was because of a race condition with dependencies I experienced locally. Not a huge deal, but it made me look at things a bit differently. |
@ajb I still need to root out some issues with the |
Looks good! The only big thing remaining is the initialization process & intervals... you say there was a race condition that you were experiencing locally? Maybe I can look into that for you? I would also be fine with this, if you think it will be an improvement:
Since we'll be releasing 1.0.0 (under a different name, too), now would be the time to make breaking changes. |
@ajb, The race condition was due to order of dependencies in sprockets. I took a stab last night at removing the auto-initialization and found that it was more complicated to include via sprockets than I had thought before. Having said that, I think that using the intervals is the best way to go, as it allows the Thoughts? |
c58e69f
to
a6b023f
Compare
callback() | ||
else | ||
@readyQueue.push callback | ||
onDebug: (message) -> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm still in favor of removing the onDebug
function completely, unless there's a reason it needs to be added.
I see a couple of potential issues with the current implementation of
|
Purpose: Adds STOMP adapter + interfaces + documentation for use with Sync.
Changes:
.travis.yml
and force install..travis.yml
rabbitmq
service and configuration in.travis.yml
(for STOMP)api_key
,auth_token
,websocket
,destination
, anddebug
to configuration.debug
to fall back as true for!production?
when omitted fromsync.yml
.Sync.onReady(..)
to accept an array of callbacks.Sync.readyQueue
callbacks do not fire until adapter is available and connected.Sync.onReady
callbacks until adapter is connected (seeonConnectInterval
).api_key
andauth_token
forlogin
andpasscode
for STOMP client authentication.subscribe(..)
under Pusher adapter class.PUSHER_API_KEY
to simplyAPI_KEY
.Stomp
adapter + subscription classes tosync.coffee.erb
.Stomp
client adapter in ruby.sync.yml
.README.md
with basic instructions for using the STOMP adapter with RabbitMQ.bundler
gem update in.travis.yml
.