Skip to content

Instantly share code, notes, and snippets.

@kidpollo
Last active December 18, 2015 03:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kidpollo/5717758 to your computer and use it in GitHub Desktop.
Save kidpollo/5717758 to your computer and use it in GitHub Desktop.
class PostCallbacks
def after_create
MagicBus::PostStream.new(self, 'create').enqueue
end
def after_update
MagicBus::PostStream.new(self, 'update').enqueue
end
def after_destroy
MagicBus::PostStream.new(self, 'delete').enqueue
end
end
module MagicBus
class PostStream < Stream
def enqueue
LegacyProcessor.enqueue_for_topic(@record, @event)
MagicBus.queue.push(
PostActivityProcessor.new(@message)
)
MagicBus.queue.push(
ElasticsearchIndexProcessor.new(@message)
)
MagicBus.queue.push(
IntegrationsProcessor.new(@message)
)
MagicBus.queue.push(
NotificationsProcessor.new(@message)
)
MagicBus.queue.push(
StatsProcessor.new(@message)
)
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment