-
Notifications
You must be signed in to change notification settings - Fork 900
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
Add dequeue method check to add_queue #22728
Conversation
app/models/ems_event.rb
Outdated
@@ -104,7 +104,7 @@ def self.bottleneck_event_groups | |||
end | |||
|
|||
def self.add_queue(meth, ems_id, event) | |||
if MiqQueue.messaging_client('event_handler').present? | |||
if MiqQueue.messaging_client('event_handler').present? && MiqQueueWorkerBase.worker_settings[:dequeue_method] != "drb" |
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.
Since we care about the event handler specifically
if MiqQueue.messaging_client('event_handler').present? && MiqQueueWorkerBase.worker_settings[:dequeue_method] != "drb" | |
if MiqQueue.messaging_client('event_handler').present? && MiqEventHandler.worker_settings[:dequeue_method] != "drb" |
85473b5
to
104a16b
Compare
This looks good, I wonder if (follow-up) we should expose this via a class method on the MiqQueueWorkerBase class since the Runner
which is essentially the same logic. |
Ah yeah that was my initial approach but I wasn't sure if exposing the runner methods was a direction we wanted to go, I'll take note for a follow-up |
Yeah we won't be able to get to the Runner instance from here, but both should be able to see the worker class |
104a16b
to
f6987ff
Compare
To pass specs, added dequeue method settings stub |
spec/models/ems_event_spec.rb
Outdated
before { stub_settings_merge(:messaging => {:type => 'artemis'}) } | ||
before { stub_settings_merge(:workers => {:worker_base => {:queue_worker_base => {:defaults => {:dequeue_method => "miq_messaging"}}}}) } |
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.
Actually sorry I missed this wasn't a -
on the first line, better to pass both keys to the stub_settings_merge
before { stub_settings_merge(:messaging => {:type => 'artemis'}) } | |
before { stub_settings_merge(:workers => {:worker_base => {:queue_worker_base => {:defaults => {:dequeue_method => "miq_messaging"}}}}) } | |
before do | |
stub_settings_merge( | |
:messaging => {:type => 'artemis'}), | |
:workers => {:worker_base => {:queue_worker_base => {:defaults => {:dequeue_method => "miq_messaging"}}}} | |
) | |
end |
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.
@nasark given the bug we had I think we should add a context here for messaging_type=>[artemis/kafka] but dequeue_method=>drb and add a test to confirm we use miq_queue not manageiq_messaging
spec/models/ems_event_spec.rb
Outdated
@@ -142,6 +143,7 @@ | |||
|
|||
context "messaging_type: kafka" do | |||
before { stub_settings_merge(:messaging => {:type => 'kafka'}) } | |||
before { stub_settings_merge(:workers => {:worker_base => {:queue_worker_base => {:defaults => {:dequeue_method => "miq_messaging"}}}}) } |
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.
Same here
f6987ff
to
ef42db7
Compare
Added specs and reordered conditional so we don't needlessly create a messaging client object |
ef42db7
to
da55e4a
Compare
Checked commit nasark@da55e4a with ruby 2.6.10, rubocop 1.28.2, haml-lint 0.35.0, and yamllint |
Add dequeue method check to add_queue (cherry picked from commit c7e045b)
Backported to quinteros in 1ee2795
|
We need to be checking which dequeue method is being used when queueing events. This is because we don't want all events to be processed by the messaging client (kafka) and only when needed i.e. event syndication.
@miq-bot assign @agrare
@miq-bot add_label bug, quinteros/yes?