-
Notifications
You must be signed in to change notification settings - Fork 4
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
Adds support for RabbitMQ messaging #153
Adds support for RabbitMQ messaging #153
Conversation
03a77e7
to
e3749c2
Compare
@@ -19,10 +19,15 @@ def save(change_set:) | |||
end | |||
|
|||
def delete(change_set:) | |||
if change_set.resource.is_a?(FileSet) |
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.
Can we move this to before_delete
?
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.
Or even better, a method that before_delete
calls.
before_delete(change_set: change_set) | ||
persister.delete(resource: change_set.resource).tap do | ||
after_commit unless transaction? | ||
end | ||
messenger.record_updated(updated_resource) if updated_resource |
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, can we move to after_commit
?
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.
And maybe we need like a...after_delete_commit
@@ -69,6 +81,12 @@ def before_save(change_set:) | |||
|
|||
def after_save(change_set:, updated_resource:) | |||
append(append_id: change_set.append_id, updated_resource: updated_resource) if change_set.append_id.present? | |||
# Update after having appended a FileSet to a Work, or updated a Work |
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.
Extract to method
app/decorators/file_set_decorator.rb
Outdated
@@ -4,4 +4,12 @@ class FileSetDecorator < Valkyrie::ResourceDecorator | |||
def manageable_files? | |||
false | |||
end | |||
|
|||
def parents | |||
Valkyrie::MetadataAdapter.find(:indexing_persister).query_service.find_parents(resource: self).to_a |
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.
Extract query_service
to its own method please.
@@ -46,4 +52,14 @@ | |||
end | |||
end | |||
end | |||
|
|||
describe "DELETE /concern/file_sets/id" do | |||
render_views |
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.
Is this necessary?
@@ -23,6 +27,7 @@ def create | |||
change_set_persister.buffer_into_index do |buffered_changeset_persister| | |||
obj = buffered_changeset_persister.save(change_set: @change_set) | |||
end | |||
messenger.record_created(obj) |
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 wonder if we need after_created
in our change set persister.
e3749c2
to
06e8826
Compare
e60aac3
to
94b6821
Compare
5602b62
to
071a058
Compare
So I don't think those it 'publishes messages in a transaction', run_real_derivatives: false, rabbit_stubbed: true do
resource = FactoryGirl.build(:scanned_resource)
change_set = change_set_class.new(resource, characterize: false)
change_set.files = [file1]
output = nil
change_set_persister.buffer_into_index do |buffer|
output = buffer.save(change_set: change_set)
end
expected_result = {
"id" => output.id.to_s,
"event" => "UPDATED",
"manifest_url" => "http://www.example.com/concern/scanned_resources/#{output.id}/manifest",
"collection_slugs" => []
}
expect(rabbit_connection).to have_received(:publish).at_least(:once).with(expected_result.to_json)
end Fixing this is hard though. I think we need to queue up events from the buffered persister, pass them into the un-buffered persister, and then run them. |
c29939b
to
c4fd76e
Compare
…on, updates, and deletion of Figgy resources Removing the initializer for GeoBlacklight Rebasing and updating in accordance with the refactored PlumChangeSetPersister Remedying the broken test suites by more effectively stubbing messaging functionality Refactoring the messaging broker integration for the PlumChangeSetPersister Implementing test suites for the PublishMessage::Factory and MessagingClient Restructuring PlumChangeSetPersister to use handlers for after_save_commit and after_delete_commit Restoring the feature test for adding resources Rebasing from e673e5e
c4fd76e
to
544f15d
Compare
Resolves #104 by adding support for RabbitMQ messaging for the creation, updates, and deletion of Figgy resources
In addition to the improvements identified by @tpendragon , the following must be addressed:
master
PlumChangeSetPersister
as registered handlersafter_save_commit
andafter_delete_commit