fix messaging bus
All checks were successful
Build and Publish / build-release (push) Successful in 1m27s
All checks were successful
Build and Publish / build-release (push) Successful in 1m27s
This commit is contained in:
@@ -6,6 +6,6 @@ defmodule PolicyService.Handlers.QuoteRequestHandler do
|
|||||||
alias PolicyService.Events.Policy.QuoteRequestSent
|
alias PolicyService.Events.Policy.QuoteRequestSent
|
||||||
|
|
||||||
def handle(%QuoteRequestSent{} = e, _metadata) do
|
def handle(%QuoteRequestSent{} = e, _metadata) do
|
||||||
PolicyService.MessageBus.publish("quote.requested", e)
|
PolicyService.MessageBus.publish("policy_service.events.quote_received", "quote.requested", e)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ defmodule PolicyService.Handlers.SolicitationRequestHandler do
|
|||||||
alias PolicyService.MessageBus
|
alias PolicyService.MessageBus
|
||||||
|
|
||||||
def handle(%QuoteAccepted{} = event, _metadata) do
|
def handle(%QuoteAccepted{} = event, _metadata) do
|
||||||
MessageBus.publish("quote.accepted", event)
|
MessageBus.publish("policy_service.events.policy_issued", "quote.accepted", event)
|
||||||
:ok
|
:ok
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
defmodule PolicyService.MessageBus do
|
defmodule PolicyService.MessageBus do
|
||||||
use AMQP
|
use AMQP
|
||||||
|
|
||||||
def publish(routing_key, event) do
|
def publish(exchange, routing_key, event) do
|
||||||
payload = Jason.encode!(event)
|
payload = Jason.encode!(event)
|
||||||
|
|
||||||
:ok =
|
:ok =
|
||||||
AMQP.Basic.publish(channel(), "policy_service.events", routing_key, payload,
|
AMQP.Basic.publish(channel(), exchange, routing_key, payload,
|
||||||
content_type: "application/json",
|
content_type: "application/json",
|
||||||
persistent: true
|
persistent: true
|
||||||
)
|
)
|
||||||
@@ -18,4 +18,4 @@ defmodule PolicyService.MessageBus do
|
|||||||
end
|
end
|
||||||
|
|
||||||
defp amqp_url, do: Application.fetch_env!(:policy_service, :amqp_url)
|
defp amqp_url, do: Application.fetch_env!(:policy_service, :amqp_url)
|
||||||
end
|
end
|
||||||
Reference in New Issue
Block a user