Skip to content

v3.0.0

Choose a tag to compare

@AVVS AVVS released this 26 Jul 16:50

<a name"3.0.0">

3.0.0 (2016-07-26)

Features

  • plugin: add multi-transport router plugin (6fac4361)

Breaking Changes

  • AMQP plugin

    • removed build-in router
      • use router module instead of build-in router

        /** CONFIG */
        // before
        config = {
          plugins: ['amqp'],
          amqp: {
            prefix: 'users',
            postfix: path.join(__dirname, 'actions'),
            initRoutes: true,
            initRouter: true,
          }
        };
        
        // after
        config = {
          plugins: ['router', 'amqp'],
          amqp: {
            router: {
              enabled: true,
            },
          },
          router: {
            routes: {
              directory: path.join(__dirname, 'actions'),
              transports: ['amqp'],
            },
          },
        };
        
        /** ACTION */
        // before
        module.exports = function action(message) {
          // `message` contains message from rabbitmq
        }
        
        // after
        function action(request) {
          // `request.params` contains message from rabbitmq
        }
        
        action.schema = 'validationSchema'; // you can use `schemaLessAction` router extension to avoid setting schema
        action.transports = ['amqp']; // you can set `setTransportsAsDefault` from router config as `true` to avoid setting transports
        
        module.exports = action;
    • changed config format
      • transport options can be configured in transport section

        // before
        const config = {
          amqp: {
            connection: {
              host: 'rabbitmq',
              port: 5672,
            },
          },
        };
        
        // after
        const config = {
          amqp: {
            transport: {
              connection: {
                host: 'rabbitmq',
                port: 5672,
              },
            }
          },
        };
      • add router section that allows to enable router plugin

    • changed router binding function name from MService.router to MService.AMQPRouter
  • SocketIO plugin

    • removed build-in router
      • use router module instead of build-in router
    • changed config format
      • socket.io options can be configured in options section
      • add router section that allows to enable router plugin

    (6fac4361)