Skip to content

Commit

Permalink
Merge pull request #351 from amplication/fix-brokers-allow-no-topics
Browse files Browse the repository at this point in the history
fix(plugins): allow rabbitmq and redis plugins to work even if no topics were defined
  • Loading branch information
mulygottlieb authored Mar 11, 2024
2 parents 1c49a69 + f912b22 commit 49226a8
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion plugins/broker-rabbitmq/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@amplication/plugin-broker-rabbitmq",
"version": "0.0.6",
"version": "0.0.7",
"description": "Use a RabbitMQ message broker to communicate between services generated with Amplication",
"main": "dist/index.js",
"nx": {},
Expand Down
5 changes: 3 additions & 2 deletions plugins/broker-rabbitmq/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,10 @@ class RabbitMQPlugin implements AmplicationPlugin {
);
const topicsModule = modules.get(topicsPath);
if (!topicsModule) {
throw new Error(
"Failed to find the topics.ts file for the message broker topics enum"
context.logger.warn(
"No message broker topics were defined and connected to your service, the generated code will not contain actual event handlers for any topic"
);
return modules;
}

const topicsFile = parse(topicsModule.code);
Expand Down
2 changes: 1 addition & 1 deletion plugins/broker-redis/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@amplication/plugin-broker-redis",
"version": "2.0.5",
"version": "2.0.6",
"description": "Use a Redis message broker in the service generated by Amplication.",
"main": "dist/index.js",
"nx": {},
Expand Down
5 changes: 3 additions & 2 deletions plugins/broker-redis/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,10 @@ class RedisBrokerPlugin implements AmplicationPlugin {
);
const topicsModule = modules.get(topicsPath);
if (!topicsModule) {
throw new Error(
"Failed to find the topics.ts file for the message broker topics enum"
context.logger.warn(
"No message broker topics were defined and connected to your service, the generated code will not contain actual event handlers for any topic"
);
return modules;
}

const topicsFile = utils.parse(topicsModule.code);
Expand Down

0 comments on commit 49226a8

Please sign in to comment.