Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement/rabbitmq channel #1204

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
completed implementation of rabbitmq in openhim
LarryMatrix committed Aug 24, 2023
commit b8d6bcc4e4fef262ca87c550a8666629a3229f12
10 changes: 1 addition & 9 deletions src/middleware/router.js
Original file line number Diff line number Diff line change
@@ -687,19 +687,13 @@ function sendKafkaRequest(ctx, route) {
function sendRabbitMQRequest(ctx, route) {
// eslint-disable-next-line no-async-promise-executor
return new Promise(async (resolve, reject) => {
const timeout = route.timeout ?? +config.router.timeout
const channel = ctx.authorisedChannel

const rabbitMQUsername = route.rabbitmqUsername
const rabbitMQPassword = route.rabbitmqPassword
const rabbitMQHost = route.rabbitmqHost
const rabbitMQExchangeName = route.rabbitmqExchangeName

const message = ctx.body.toString()

let connection

let response = {
const response = {
status: ctx.response.status,
message: 'Message Received in RabbitMQ Successfully!'
}
@@ -710,11 +704,9 @@ function sendRabbitMQRequest(ctx, route) {
)

const channel = await connection.createChannel()

await channel.assertExchange(rabbitMQExchangeName, 'fanout', {
durable: true
})

channel.publish(rabbitMQExchangeName, '', Buffer.from(message))
resolve({
status: 200,