-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #89 from thanhdanh27600/staging
fix export
- Loading branch information
Showing
2 changed files
with
26 additions
and
25 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,3 +40,4 @@ next-env.d.ts | |
*.env.production | ||
prisma/*.db* | ||
/logs | ||
*.log |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,27 @@ | ||
//@ts-nocheck | ||
// @ts-nocheck | ||
export = {}; | ||
// const { AMQPClient } = require('@cloudamqp/amqp-client'); | ||
|
||
const { AMQPClient } = require('@cloudamqp/amqp-client'); | ||
// async function initRabbitMQ() { | ||
// try { | ||
// const amqp = new AMQPClient(process.env.RABBITMQ_URL); | ||
// const conn = await amqp.connect(); | ||
// const channel = await conn.channel(); | ||
// const queue = await channel.queue('shortened'); // RabbitMQChannel.SHORTENED | ||
// await queue.subscribe({ noAck: true }, consumer); | ||
// console.log('RabittMQ is running'); | ||
// } catch (error) { | ||
// console.error('RabittMQ', error); | ||
// error.connection.close(); | ||
// } | ||
// } | ||
|
||
async function initRabbitMQ() { | ||
try { | ||
const amqp = new AMQPClient(process.env.RABBITMQ_URL); | ||
const conn = await amqp.connect(); | ||
const channel = await conn.channel(); | ||
const queue = await channel.queue('shortened'); // RabbitMQChannel.SHORTENED | ||
await queue.subscribe({ noAck: true }, consumer); | ||
console.log('RabittMQ is running'); | ||
} catch (error) { | ||
console.error('RabittMQ', error); | ||
error.connection.close(); | ||
} | ||
} | ||
|
||
const consumer = async (msg) => { | ||
// console.log('RabittMQ received: ', msg.bodyToString()); | ||
console.log(JSON.parse(msg.bodyToString())); | ||
await setTimeout(() => { | ||
console.log('processed', msg.bodyToString()); | ||
}, 5000); | ||
// await consumer.cancel(); | ||
}; | ||
module.exports = { initRabbitMQ }; | ||
// const consumer = async (msg) => { | ||
// // console.log('RabittMQ received: ', msg.bodyToString()); | ||
// console.log(JSON.parse(msg.bodyToString())); | ||
// await setTimeout(() => { | ||
// console.log('processed', msg.bodyToString()); | ||
// }, 5000); | ||
// // await consumer.cancel(); | ||
// }; | ||
// module.exports = { initRabbitMQ }; |