cdmbase / graphql-rabbitmq-subscriptions

A graphql subscriptions implementation using rabbimq and apollo's graphql-subscriptions
MIT License
118 stars 27 forks source link

AMQPPubSub no longer correctly implements PubSubEngine interface #19

Open AlexKarlsen opened 3 years ago

AlexKarlsen commented 3 years ago

The interface defined in graphql-subscription@1.2.1 has changed to the following:

export abstract class PubSubEngine {
  public abstract publish(triggerName: string, payload: any): Promise<void>;
  public abstract subscribe(triggerName: string, onMessage: Function, options: Object): Promise<number>;
  public abstract unsubscribe(subId: number);
  public asyncIterator<T>(triggers: string | string[]): AsyncIterator<T> {
    return new PubSubAsyncIterator<T>(this, triggers);
  }
}

In the currently used version of graphql-subscription@0.4.4 the interface of the publish method is:

export abstract class PubSubEngine {
  public abstract publish(triggerName: string, payload: any): boolean;
  ...
}

This should of course be changed to:

export abstract class PubSubEngine {
  public abstract publish(triggerName: string, payload: any): Promise<void><;
  ...
}