with Grafana and RabbitMQ?
import { axios } from "@pipedream/platform"
export default defineComponent({
props: {
grafana: {
type: "app",
app: "grafana",
}
},
async run({steps, $}) {
return await axios($, {
url: `${this.grafana.$auth.domain}/api/org/`,
headers: {
Authorization: `Bearer ${this.grafana.$auth.service_account_token}`,
"accept": `application/json`,
},
})
},
})
import amqp from "amqplib";
export default defineComponent({
props: {
rabbitmq: {
type: "app",
app: "rabbitmq",
}
},
async run({ steps, $ }) {
const url = `amqp://${this.rabbitmq.$auth.username}:${this.rabbitmq.$auth.password}@${this.rabbitmq.$auth.host}:${this.rabbitmq.$auth.port}`;
const connection = await amqp.connect(url);
const channel = await connection.createChannel();
const queue = 'Sample Queue';
await channel.assertQueue(queue, { durable: true });
const message = 'Welcome RabbitMQ + Pipedream users! ' + new Date().toISOString()
channel.sendToQueue(queue, Buffer.from(message), { persistent: true });
console.log(`Sent: ${message}`);
const queueInfo = await channel.checkQueue(queue);
return queueInfo;
},
})