Skip to content

Instantly share code, notes, and snippets.

[{
"id":1,
"value": {
"text": "We can't see the future, but we can taste, smell, feel, and hear it."
}
},
{
"id": 2,
"value": {
"text": "It's like having a crystal ball except not bullshit."
[{
"id": 1,
"value": {
"text": "The Daily Planet can eat shit."
}
},
{
"id": 2,
"value": {
"text": "I find your lack of subscription disturbing."
[{
"id": 1,
"value": {
"text": "Yo dawg, I heard you like TK so I created a newsletter about TK and also other stuff because being well rounded is important."
}
},
{
"id": 2,
"value": {
"text": "Fascinated by TK? We're right there with you."
[{
"id": 1,
"value": {
"widget": 15000
}
},
{
"id": 2,
"value": {
"widget": 30000
[{
"id": 1,
"value": {
"text": "1 article",
"widget": 1
}
},
{
"id": 2,
"value": {
[{
"id": 1,
"value": {
"text": "control",
"widget": "control"
}
},
{
"id": 2,
"value": {
{
"countPerTypes": [
{
"platform": "web",
"category": "notFound",
"entries": [
{
"count": "208",
"timestamp": "2017-04-21T20:15:33.136Z"
},
[{
"id": 1,
"value": {
"text": "input",
"widget": "input"
}
},
{
"id": 2,
"value": {
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
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