Skip to content

Commit

Permalink
Merge pull request activepieces#5344 from alinperghel/feat/rabbitmq-p…
Browse files Browse the repository at this point in the history
…iece

feat(rabbitmq): add support for vhosts
  • Loading branch information
abuaboud authored Aug 13, 2024
2 parents 0ae02ba + f2cc7fc commit 0f2cd8d
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/pieces/community/rabbitmq/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@activepieces/piece-rabbitmq",
"version": "0.0.1",
"version": "0.0.2",
"dependencies": {
"amqplib": "^0.10.4"
},
Expand Down
5 changes: 5 additions & 0 deletions packages/pieces/community/rabbitmq/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ export const rabbitmqAuth = PieceAuth.CustomAuth({
description: "Port",
required: true,
}),
vhost: Property.ShortText({
displayName: "Virtual Host",
description: "Virtual Host",
required: false,
}),
},
});

Expand Down
7 changes: 6 additions & 1 deletion packages/pieces/community/rabbitmq/src/lib/common/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,10 @@ export async function rabbitmqConnect(
}

function createAmqpURI(auth: PiecePropValueSchema<typeof rabbitmqAuth>): string {
return `amqp://${auth.username}:${auth.password}@${auth.host}:${auth.port}`;
const uri = `amqp://${auth.username}:${auth.password}@${auth.host}:${auth.port}`;

if (!auth.vhost) {
return uri;
}
return `${uri}/${auth.vhost}`;
}

0 comments on commit 0f2cd8d

Please sign in to comment.