rails-lambda/lambdakiq

Sidekiq replacement

Closed this issue · 1 comments

Hello!

Great project and the whole initiative to move rails to lambda!

Trying to set up Rails Lambda environment and last step is to get SQS operational.
Locally and for testing the project uses Sidekiq, so after this line A drop-in replacement for Sidekiq when running Rails in AWS Lambda using the Lamby gem. I presumed that it would be super smooth to transition to Lambdakiq.

Rails is 6.1.3, Sidekiq 6.2.2

The issue comes with peform_async not being available in Lambdakiq I guess.

Am I missing some integration step or is the Lambdakiq intended for different versions or different implementations?

Issue comes with workers:

class DailyNotificationWorker
  include Sidekiq::Worker # This line throws error...

  # @param [Integer] id ID of the DocumentFile
  def perform(id)
    user = User.find(id)
    return if user.email.nil?
...

And in code, when trying to start a worker:

    user_ids_with_actions.each do |id|
        DailyNotificationWorker.perform_async(id)
    end

I would highly appreciate the direction!
Is there some example gist of file I could be pointed to?

Thank you in advance!

Rewritten my code to this and it works:

class DailyNotificationWorker < ApplicationJob
  # @param [Integer] id ID of the DocumentFile
  def perform(id)
    user = User.find(id)
    return if user.email.nil?
...
    user_ids_with_actions.each do |id|
      DailyNotificationWorker.perform_later(id)
    end