moleculerjs / moleculer-channels

Reliable messages for Moleculer services via external queue/channel/topic.
MIT License
76 stars 15 forks source link

MoleculerRetryableError: Adapter not yet connected. Skipping publishing #83

Open valeeum opened 2 months ago

valeeum commented 2 months ago

Prerequisites

Please answer the following questions for yourself before submitting an issue.

Current Behavior

When i call this.broker.sendToChannel() in my service started method, i get the following error:

MoleculerRetryableError: Adapter not yet connected. Skipping publishing

  started() {
    setTimeout(() => {
      try {
        this.broker.sendToChannel(
          `user.events`,
          { blah: 2 },
        );
      } catch (error) {
        this.logger.error({ error });
      }
    }, 1000);
  },

In the snippet above, waiting 1 second after started is called creates an error. When I wait 10 seconds, i dont get this error.

I am using the latest version of the Redis adapter.

Expected Behavior

I expect the broker to wait until the connection is made before starting services.

FlavioF commented 3 weeks ago

I am experiencing the same behaviour. Did you come up with any solution @valeeum ?

valeeum commented 3 weeks ago

@FlavioF nope, unfortunately not.