Mild adjustments
This commit is contained in:
@@ -3,7 +3,7 @@ defmodule NeonVertigoService.MessageProcessor do
|
||||
|
||||
import Ecto.Query, only: [from: 2]
|
||||
|
||||
def process_message(mqtt_pid, {"auctions", "create"}, payload, properties) do
|
||||
def process_message(mqtt_pid, {"auctions", "created"}, payload, properties) do
|
||||
changeset = Auction.changeset(%Auction{}, payload)
|
||||
reply = case Repo.insert(changeset) do
|
||||
{:ok, auction} ->
|
||||
@@ -12,7 +12,7 @@ defmodule NeonVertigoService.MessageProcessor do
|
||||
%{ok: false, gid: changeset |> Ecto.Changeset.get_field(:gid)}
|
||||
end
|
||||
|
||||
reply(reply, mqtt_pid, properties)
|
||||
reply(reply, mqtt_pid, properties, [qos: 2])
|
||||
end
|
||||
|
||||
def process_message(mqtt_pid, {"auctions", auction_gid, "bid"}, payload, properties) do
|
||||
@@ -28,7 +28,7 @@ defmodule NeonVertigoService.MessageProcessor do
|
||||
bidder_gid: bid.bidder_gid,
|
||||
timestamp: bid.bid_timestamp
|
||||
}
|
||||
send_mqtt(bid_data, mqtt_pid, "notify/new_bid/#{auction.gid}")
|
||||
send_mqtt(bid_data, mqtt_pid, "notify/new_bid/#{auction.gid}", qos: 2)
|
||||
%{ok: true}
|
||||
{:error, changeset} -> %{ok: false}
|
||||
end
|
||||
|
||||
@@ -13,7 +13,8 @@ defmodule NeonVertigoService.Mqtt.Server do
|
||||
{:ok, %MqttServer{}, {:continue, :post_init}}
|
||||
end
|
||||
|
||||
# Callbacks
|
||||
# == Callbacks ==
|
||||
|
||||
def handle_continue(:post_init, %MqttServer{} = state) do
|
||||
mqtt_config = Application.fetch_env!(:neon_vertigo_service, :mqtt_params)
|
||||
{:ok, mqtt_pid} = Supervisor.start_child(
|
||||
|
||||
Reference in New Issue
Block a user