rhea/rhea.js
function amqpSenderNode(config) {

        RED.nodes.createNode(this, config);

        // get endpoint configuration
        this.endpoint = RED.nodes.getNode(config.endpoint);
        // get all other configuration
        this.address = config.address;
        this.autosettle = config.autosettle;
        this.dynamic = config.dynamic;
        this.sndsettlemode = config.sndsettlemode;
        this.rcvsettlemode = config.rcvsettlemode;
        this.durable = config.durable;
        this.expirypolicy = config.expirypolicy;

        var node = this;
        // node not yet connected
        this.status({ fill: 'red', shape: 'dot', text: 'disconnected' });

        if (node.endpoint) {

            node.endpoint.connect(function(connection) {
                setup(connection);
            });

            /**
             * Node setup for creating sender link
             *
             * @param connection    Connection instance
             */
            function setup(connection) {

                node.connection = connection;

                // node connected
                node.status({ fill: 'green', shape: 'dot', text: 'connected' });

                // build sender options based on node configuration
                var options = {
                    target: {
                        address: node.address,
                        dynamic: node.dynamic,
                        durable: node.durable,
                        expiry_policy: node.expirypolicy
                    },
                    autosettle: node.autosettle,
                    snd_settle_mode: node.sndsettlemode,
                    rcv_settle_mode: node.rcvsettlemode
                };
                node.sender = node.connection.open_sender(options);

                node.sender.on('accepted', function(context) {
                    var msg = outDelivery(node, context.delivery);
                    node.send(msg);
                });

                node.sender.on('released', function(context) {
                    var msg = outDelivery(node, context.delivery);
                    node.send(msg);
                });

                node.sender.on('rejected', function(context) {
                    var msg = outDelivery(node, context.delivery);
                    node.send(msg);
                });

                node.connection.on('disconnected', function(context) {
                    // node disconnected
                    node.status({fill: 'red', shape: 'dot', text: 'disconnected' });
                });

                node.on('input', function(msg) {
                    // enough credits to send
                    if (node.sender.sendable()) {
                        node.sender.send(msg.payload);
                    }
                });

                node.on('close', function() {
                    if (node.sender != null)
                        node.sender.detach();
                    node.connection.close();
                });
            }

        }
    }
function amqpSenderNode(config) {

        RED.nodes.createNode(this, config);

        // get endpoint configuration
        this.endpoint = RED.nodes.getNode(config.endpoint);
        // get all other configuration
        this.address = config.address;
        this.autosettle = config.autosettle;
        this.dynamic = config.dynamic;
        this.sndsettlemode = config.sndsettlemode;
        this.rcvsettlemode = config.rcvsettlemode;
        this.durable = config.durable;
        this.expirypolicy = config.expirypolicy;

        var node = this;
        // node not yet connected
        this.status({ fill: 'red', shape: 'dot', text: 'disconnected' });

        if (node.endpoint) {

            node.endpoint.connect(function(connection) {
                setup(connection);
            });

            /**
             * Node setup for creating sender link
             *
             * @param connection    Connection instance
             */
            function setup(connection) {

                node.connection = connection;

                // node connected
                node.status({ fill: 'green', shape: 'dot', text: 'connected' });

                // build sender options based on node configuration
                var options = {
                    target: {
                        address: node.address,
                        dynamic: node.dynamic,
                        durable: node.durable,
                        expiry_policy: node.expirypolicy
                    },
                    autosettle: node.autosettle,
                    snd_settle_mode: node.sndsettlemode,
                    rcv_settle_mode: node.rcvsettlemode
                };
                node.sender = node.connection.open_sender(options);

                node.sender.on('accepted', function(context) {
                    var msg = outDelivery(node, context.delivery);
                    node.send(msg);
                });

                node.sender.on('released', function(context) {
                    var msg = outDelivery(node, context.delivery);
                    node.send(msg);
                });

                node.sender.on('rejected', function(context) {
                    var msg = outDelivery(node, context.delivery);
                    node.send(msg);
                });

                node.connection.on('disconnected', function(context) {
                    // node disconnected
                    node.status({fill: 'red', shape: 'dot', text: 'disconnected' });
                });

                node.on('input', function(msg) {
                    // enough credits to send
                    if (node.sender.sendable()) {
                        node.sender.send(msg.payload);
                    }
                });

                node.on('close', function() {
                    if (node.sender != null)
                        node.sender.detach();
                    node.connection.close();
                });
            }

        }
    }
function amqpSenderNode ( config ) { RED . nodes . createNode ( this , config ) ; // get endpoint configuration this . endpoint = RED . nodes . getNode ( config . endpoint ) ; // get all other configuration this . address = config . address ; this . autosettle = config . autosettle ; this . dynamic = config . dynamic ; this . sndsettlemode = config . sndsettlemode ; this . rcvsettlemode = config . rcvsettlemode ; this . durable = config . durable ; this . expirypolicy = config . expirypolicy ; var node = this ; // node not yet connected this . status ( { fill : 'red' , shape : 'dot' , text : 'disconnected' } ) ; if ( node . endpoint ) { node . endpoint . connect ( function ( connection ) { setup ( connection ) ; } ) ; /**
             * Node setup for creating sender link
             *
             * @param connection    Connection instance
             */ function setup ( connection ) { node . connection = connection ; // node connected node . status ( { fill : 'green' , shape : 'dot' , text : 'connected' } ) ; // build sender options based on node configuration var options = { target : { address : node . address , dynamic : node . dynamic , durable : node . durable , expiry_policy : node . expirypolicy } , autosettle : node . autosettle , snd_settle_mode : node . sndsettlemode , rcv_settle_mode : node . rcvsettlemode } ; node . sender = node . connection . open_sender ( options ) ; node . sender . on ( 'accepted' , function ( context ) { var msg = outDelivery ( node , context . delivery ) ; node . send ( msg ) ; } ) ; node . sender . on ( 'released' , function ( context ) { var msg = outDelivery ( node , context . delivery ) ; node . send ( msg ) ; } ) ; node . sender . on ( 'rejected' , function ( context ) { var msg = outDelivery ( node , context . delivery ) ; node . send ( msg ) ; } ) ; node . connection . on ( 'disconnected' , function ( context ) { // node disconnected node . status ( { fill : 'red' , shape : 'dot' , text : 'disconnected' } ) ; } ) ; node . on ( 'input' , function ( msg ) { // enough credits to send if ( node . sender . sendable ( ) ) { node . sender . send ( msg . payload ) ; } } ) ; node . on ( 'close' , function ( ) { if ( node . sender != null ) node . sender . detach ( ) ; node . connection . close ( ) ; } ) ; } } }
Node for AMQP sender
Node for AMQP sender