mirror of
https://github.com/ditkrg/outboxable.git
synced 2026-01-22 22:06:47 +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
|
# Declare a exchange
|
||||||
exchange = channel.topic(@resource.exchange, durable: true)
|
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
|
# Publish the CloudEvent resource to the exchange
|
||||||
exchange.publish(
|
exchange.publish(
|
||||||
to_envelope(resource: @resource),
|
to_envelope(resource: @resource),
|
||||||
routing_key: @resource.routing_key,
|
routing_key: @resource.routing_key,
|
||||||
headers: @resource.try(:headers) || {},
|
headers: @resource.try(:headers) || {},
|
||||||
content_type:
|
content_type: @resource.try(:content_type) || 'application/json'
|
||||||
)
|
)
|
||||||
|
|
||||||
# Wait for confirmation
|
# Wait for confirmation
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user