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

Sqs active job as own gem #144

Closed
wants to merge 2 commits into from
Closed

Conversation

ckhsponge
Copy link

Issue #, 142

Description of changes:

Moved sqs-active-job to a top level directory and created it's own gemspec.

By submitting this pull request, I confirm that my contribution is made under
the terms of the Apache 2.0 license.

@ckhsponge
Copy link
Author

Tests are working yet, the dummy environment needs to be unwound from other dependencies.

@mullermp
Copy link
Contributor

mullermp commented Oct 2, 2024

Thanks. I'll get back to you in this. We will want to think about gem naming and plan out work to move features out of the rails gem.

@ckhsponge
Copy link
Author

Sounds good. I'll do some real world of testing of this meanwhile.

@mullermp
Copy link
Contributor

mullermp commented Oct 3, 2024

Thanks. It may be a bit before I get to this. I am thinking maybe it shouldn't live in this GitHub if it's not exclusively for rails. We have a gem called aws-sessionstore-dynamodb that works for rack applications, and then we have a rails layer for it. I am thinking we would want an aws-activejob-sqs gem and repository. I am thinking whether or not Rails loading checks should be done in both cases, removed from aws-sdk-rails. E.g. If Rails was loaded, then insert a railtie or look for config.

@ckhsponge
Copy link
Author

@mullermp A completely seperate gem does seem like a decent and logical way to go. However, ActiveJob is part of the Rails project so keeping AWS support for ActiveJob close to Rails support could make sense as well.

I agree that the conditional Rails loading checks aren't great. There's only 2 of them and I suspect there may be a way to remove them.

Copy link
Contributor

@alextwoods alextwoods left a comment

Choose a reason for hiding this comment

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

This is looking good - great work and thanks for starting this. I think its a great idea to break this out as an independent gem!

@@ -32,5 +32,7 @@ Gem::Specification.new do |spec|
spec.add_dependency('concurrent-ruby', '~> 1.3', '>= 1.3.1') # Utilities for concurrent processing
spec.add_dependency('railties', '>= 7.0.0') # Minimum supported Rails version

spec.add_dependency('sqs-active-job', version)
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we potentially would want this to be an open ended dependency

Copy link
Contributor

Choose a reason for hiding this comment

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

Does spec.executables = ['aws_sqs_active_job'] still work with the gem split out?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think we can also remove sqs and concurrent-ruby from the dependencies here.

@@ -15,6 +16,8 @@ module Rails
#
# SQS-based queuing backend for Active Job.
module SqsActiveJob
VERSION = File.read(File.expand_path('../../VERSION', __dir__)).strip
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we'd probably want to start versioning this separately

end

def run
# exit 0
boot_rails
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure the best way to do this, but what about trying to require rails and running boot_rails only when its available? something like:

begin
  require 'rails'
  boot_rails
rescue LoadError
 # no boot
end

Copy link
Author

Choose a reason for hiding this comment

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

Thanks for reviewing.

I moved the Rails booting to the executable which I think is a better place for it. The poller doesn't need to control what environment it's polling in. If you really want the poller to do booting we could split the poll method to boot and then call poll_without_booting_rails. This new method poll_without_booting_rails could then be used by non-rails environments that want to do polling. Other environments can easily create their own executables if desired.

@mullermp
Copy link
Contributor

Work has been moved to aws/aws-activejob-sqs-ruby#1

@mullermp mullermp closed this Nov 12, 2024
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.

3 participants