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