This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[{ | |
"id": 1, | |
"value": { | |
"text": "1 article", | |
"widget": 1 | |
} | |
}, | |
{ | |
"id": 2, | |
"value": { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[{ | |
"id": 1, | |
"value": { | |
"text": "control", | |
"widget": "control" | |
} | |
}, | |
{ | |
"id": 2, | |
"value": { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"countPerTypes": [ | |
{ | |
"platform": "web", | |
"category": "notFound", | |
"entries": [ | |
{ | |
"count": "208", | |
"timestamp": "2017-04-21T20:15:33.136Z" | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule MyApp.MySubscriber do | |
def handle(%{"tag" => "a_tag"} = data, _meta) do | |
MyApp.MyModule.handle_event data | |
end | |
def handle(%{"tag" => "another_tag"} = data, _meta) do | |
MyApp.MyOtherModule.handle_event data | |
end | |
def handle(_payload, _meta) do | |
# noop |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule Toolex.AMQP.SubscriberBase do | |
use GenServer | |
... | |
def handle_info({:basic_deliver, payload, meta}, state) do | |
Logger.info "Deliver received for #{state.module}" | |
try do | |
payload = Poison.decode!(payload) | |
apply state.module, :handle, [payload, meta] | |
AMQP.Basic.ack state.channel, meta.delivery_tag |
OlderNewer