mirror of
https://github.com/ditkrg/outboxable.git
synced 2026-01-22 13:56:49 +00:00
Refactors code for better readablity
This commit is contained in:
parent
035a9822ee
commit
816465eced
@ -19,18 +19,12 @@ module Outboxable
|
||||
# Declare a exchange
|
||||
exchange = channel.topic(@resource.exchange, durable: true)
|
||||
|
||||
content_type = if @resource.respond_to?(:content_type) && @resource.content_type.present?
|
||||
@resource.content_type
|
||||
else
|
||||
'application/json'
|
||||
end
|
||||
|
||||
# Publish the CloudEvent resource to the exchange
|
||||
exchange.publish(
|
||||
to_envelope(resource: @resource),
|
||||
routing_key: @resource.routing_key,
|
||||
headers: @resource.try(:headers) || {},
|
||||
content_type:
|
||||
content_type: @resource.try(:content_type) || 'application/json'
|
||||
)
|
||||
|
||||
# Wait for confirmation
|
||||
|
||||
Loading…
Reference in New Issue
Block a user