From 816465eced3e7deb0b32845556179f1c1c8c3a63 Mon Sep 17 00:00:00 2001 From: Muhammad Nawzad Date: Tue, 28 May 2024 13:51:17 +0300 Subject: [PATCH] Refactors code for better readablity --- lib/outboxable/rabbitmq/publisher.rb | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/lib/outboxable/rabbitmq/publisher.rb b/lib/outboxable/rabbitmq/publisher.rb index 0a02eb2..1770881 100644 --- a/lib/outboxable/rabbitmq/publisher.rb +++ b/lib/outboxable/rabbitmq/publisher.rb @@ -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