ParseMessageQueue.js 3.4 KB

123456789101112131415161718192021222324
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.ParseMessageQueue = void 0;
  6. var _AdapterLoader = require("./Adapters/AdapterLoader");
  7. var _EventEmitterMQ = require("./Adapters/MessageQueue/EventEmitterMQ");
  8. const ParseMessageQueue = exports.ParseMessageQueue = {};
  9. ParseMessageQueue.createPublisher = function (config) {
  10. const adapter = (0, _AdapterLoader.loadAdapter)(config.messageQueueAdapter, _EventEmitterMQ.EventEmitterMQ, config);
  11. if (typeof adapter.createPublisher !== 'function') {
  12. throw 'pubSubAdapter should have createPublisher()';
  13. }
  14. return adapter.createPublisher(config);
  15. };
  16. ParseMessageQueue.createSubscriber = function (config) {
  17. const adapter = (0, _AdapterLoader.loadAdapter)(config.messageQueueAdapter, _EventEmitterMQ.EventEmitterMQ, config);
  18. if (typeof adapter.createSubscriber !== 'function') {
  19. throw 'messageQueueAdapter should have createSubscriber()';
  20. }
  21. return adapter.createSubscriber(config);
  22. };
  23. //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJfQWRhcHRlckxvYWRlciIsInJlcXVpcmUiLCJfRXZlbnRFbWl0dGVyTVEiLCJQYXJzZU1lc3NhZ2VRdWV1ZSIsImV4cG9ydHMiLCJjcmVhdGVQdWJsaXNoZXIiLCJjb25maWciLCJhZGFwdGVyIiwibG9hZEFkYXB0ZXIiLCJtZXNzYWdlUXVldWVBZGFwdGVyIiwiRXZlbnRFbWl0dGVyTVEiLCJjcmVhdGVTdWJzY3JpYmVyIl0sInNvdXJjZXMiOlsiLi4vc3JjL1BhcnNlTWVzc2FnZVF1ZXVlLmpzIl0sInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IGxvYWRBZGFwdGVyIH0gZnJvbSAnLi9BZGFwdGVycy9BZGFwdGVyTG9hZGVyJztcbmltcG9ydCB7IEV2ZW50RW1pdHRlck1RIH0gZnJ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