Created
April 1, 2019 11:18
-
-
Save goldblade/a67ef50729662e6dafc92ae83a9e4da9 to your computer and use it in GitHub Desktop.
Rabbit send message
This file contains hidden or 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
#!/usr/bin/env node | |
const rabbit = { | |
uuid: "229aaca7-51f3-43bd-a306-95e13d190bc4", | |
fullname: "Ikki de Fênix", | |
email: "[email protected]", | |
network_email: "[email protected]", | |
cpf: "111.111.111-11", | |
gender: "male", | |
languages: { | |
spanish: "basic", | |
english: "intermediary" | |
}, | |
location: { | |
city: null, | |
state: "Rio de Janeiro", | |
country: null | |
}, | |
slack: { | |
id: "U90418USW", | |
username: "fenix" | |
}, | |
rocket_chat: { | |
id: "cjhEp6WL9CdPPvyAN", | |
username: "ikki", | |
last_login_at: null | |
}, | |
bank_account: {}, | |
skills: [ | |
{ | |
label: "Frontend - JS", | |
macro_area: "Frontend", | |
value: "18.5", | |
skill_value: 2, | |
experience_time: "Entre 1 e 3 anos" | |
}, | |
{ | |
label: "Frontend - HTML/CSS", | |
macro_area: "Frontend", | |
value: "18.5", | |
skill_value: 3, | |
experience_time: "Entre 1 e 3 anos" | |
}, | |
{ | |
label: "Backend - Java", | |
macro_area: "Backend", | |
value: "22.0", | |
skill_value: 1, | |
experience_time: "Entre 1 e 3 anos" | |
}, | |
{ | |
label: "Backend - Javascript", | |
macro_area: "Backend", | |
value: "22.0", | |
skill_value: 2, | |
experience_time: "Entre 1 e 3 anos" | |
}, | |
{ | |
label: "Backend - Python", | |
macro_area: "Backend", | |
value: "22.0", | |
skill_value: 2, | |
experience_time: "Entre 1 e 3 anos" | |
}, | |
{ | |
label: "Backend - Ruby", | |
macro_area: "Backend", | |
value: "22.0", | |
skill_value: 3, | |
experience_time: "Entre 1 e 3 anos" | |
} | |
], | |
referrer: null, | |
impulso_on_linkedin: false, | |
linkedin: { | |
uid: "CqCSWoiePw" | |
}, | |
projects: [], | |
opportunities_feed: [], | |
created_at: "2018-12-13T17:01:41.708Z", | |
maturity_levels: [ | |
{ | |
area: "Geral", | |
level: null | |
}, | |
{ | |
area: "Backend", | |
level: null | |
}, | |
{ | |
area: "Frontend", | |
level: null | |
}, | |
{ | |
area: "Mobile", | |
level: null | |
}, | |
{ | |
area: "Design", | |
level: null | |
}, | |
{ | |
area: "Gest√£o", | |
level: null | |
}, | |
{ | |
area: "QA", | |
level: null | |
}, | |
{ | |
area: "Infra", | |
level: null | |
} | |
], | |
current_plan: null | |
}; | |
const url = process.env.CLOUDAMQP_URL; | |
const queue = process.env.CLOUDMQP_QUEUE; | |
require("amqplib/callback_api").connect(url, (err, conn) => { | |
if (err) console.log(err); | |
conn.createChannel((err, ch) => { | |
if (err) console.log(err); | |
ch.assertExchange(queue, "fanout", { durable: false }); | |
ch.sendToQueue(queue, new Buffer(JSON.stringify(rabbit))); | |
console.log(" [x] Sent %s ", JSON.stringify(rabbit)); | |
}); | |
setTimeout(function() { | |
conn.close(); | |
process.exit(0); | |
}, 500); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment