with Kafka and Render?
import { Kafka } from "kafkajs"
export default defineComponent({
props: {
kafka: {
type: "app",
app: "kafka",
}
},
async run({steps, $}) {
const kafka = new Kafka({
brokers: [`${this.kafka.$auth.host}:${this.kafka.$auth.port}`],
});
const consumer = kafka.consumer({ groupId: 'TestGroup' });
await consumer.connect()
await consumer.subscribe({ topic: 'SampleTopic', fromBeginning: true });
let consumedMessage = "";
const eachMessage = async function({ topic, partition, message }){
consumedMessage = message.value.toString();
return consumedMessage;
};
await consumer.run({
eachMessage,
});
const producer = kafka.producer();
await producer.connect()
await producer.send({
topic: 'SampleTopic',
messages: [
{ value: 'Welcome KafkaJS + Pipedream users! '+ new Date().toISOString() },
],
});
await producer.disconnect();
const data = await consumer.describeGroup();
return { consumedMessage, groupDescription: data };
},
})
The Render API enables developers to automate deployment workflows, manage services, and interact with Render's infrastructure programmatically. Through Pipedream, you can tap into this API to create powerful serverless workflows that seamlessly integrate with your DevOps pipeline. By connecting Render with other apps available on Pipedream, you can orchestrate complex automation scenarios, monitoring, and notifications, ensuring that your deployment process is as efficient and responsive as possible.
import { axios } from "@pipedream/platform"
export default defineComponent({
props: {
render: {
type: "app",
app: "render",
}
},
async run({steps, $}) {
return await axios($, {
url: `https://api.render.com/v1/owners`,
headers: {
Authorization: `Bearer ${this.render.$auth.api_key}`,
"Accept": `application/json`,
},
})
},
})