lehno / moleculer-amqp-queue

MIT License
4 stars 11 forks source link

Example files don't work because of AMQPMixin() #8

Closed patrickmpoon closed 3 years ago

patrickmpoon commented 3 years ago

Example files are not working because AMQPMixin is being called as a function even though src/index.js is exporting a JSON object. Removing the parens fixes the issue:

$ git diff head
diff --git a/examples/pub/index.js b/examples/pub/index.js
index 8a4c0f8..f3e5d63 100644
--- a/examples/pub/index.js
+++ b/examples/pub/index.js
@@ -7,7 +7,7 @@ let broker = new ServiceBroker({ logger: console });

 broker.createService({
        name: "pub",
-       mixins: [AMQPMixin()],
+       mixins: [AMQPMixin],
        started () {
                let id = 1;
                setInterval(() => {
diff --git a/examples/simple/index.js b/examples/simple/index.js
index c56adab..1422f1a 100644
--- a/examples/simple/index.js
+++ b/examples/simple/index.js
@@ -7,7 +7,7 @@ let broker = new ServiceBroker({ logger: console });

 broker.createService({
        name: "pub",
-       mixins: [AMQPMixin()],
+       mixins: [AMQPMixin],
        started () {
                let id = 1;
                setInterval(async () => {
@@ -19,7 +19,7 @@ broker.createService({

 broker.createService({
        name: "task-worker",
-       mixins: [AMQPMixin()],
+       mixins: [AMQPMixin],
        AMQPQueues: {
                "sample.task" (channel, msg) {
                        let job = JSON.parse(msg.content.toString());
diff --git a/examples/worker/index.js b/examples/worker/index.js
index 0bfb59b..ad0976c 100644
--- a/examples/worker/index.js
+++ b/examples/worker/index.js
@@ -7,7 +7,7 @@ let broker = new ServiceBroker({ logger: console });

 broker.createService({
        name: "task-worker",
-       mixins: [AMQPMixin()],
+       mixins: [AMQPMixin],
        AMQPQueues: {
                "sample.task" (channel, msg) {
                        let job = JSON.parse(msg.content.toString());
lehno commented 3 years ago

A merge with a better example has been approved.