Skip to content

Source is not configured/Groups #23

Description

@thxmike

In the below example, when attempting to run, the system fails with "Source is not configured"
This is failing on the extract_pump. Not sure why this is failing in the group

var datapumps = require('datapumps');
var mssql = require('mssql');
Promise = require('bluebird');

var config = {
    user: 'user',
    password: pw',
    server: 'server', // You can use 'localhost\\instance' to connect to named instance
    database: 'db',
    stream: true, // You can enable streaming globally
    requestTimeout: 60000,
    options: {
        encrypt: false // Use this if you're on Windows Azure
    }
}

var connection = new mssql.Connection(config, function (err) {

    if (err) {
        console.log(err);
        return;
    }

    var request = connection.request();

    request.query('select top 10 column from table where anothercolumn = 0', function (err, recordset) {
        // ... error checks
        if (err) {
            console.log(err);
        }

        //Only executed if not streaming i.e streaming = false
        //console.log(recordset);

    });

    //All Event Emitters are used when streaming i.e streaming = true
    request.on('recordset', function (columns) {
        // Emitted once for each recordset in a query
    });

    request.on('row', function (row) {
        // Emitted for each row
        extract_input_buffer.writeAsync(row);

        console.log(extract_input_buffer.content.length);
    });

    request.on('error', function (err) {
        // May be emitted multiple times
    });

    request.on('done', function (returnValue) {
        // Always emitted as the last one
        connection.close();
        extract_input_buffer.seal();

    });

});

var pump_group = new datapumps.group();

var extract_pump = new datapumps.Pump();

var extract_input_buffer = new datapumps.Buffer({size: 100});

var extract_output_buffer = extract_pump.buffer();

extract_pump.errorBuffer().on('write', function (data) {
    console.log(data);
});

extract_pump.buffer('output').on('write', function (data) {
    console.log(extract_output_buffer.content.length);
});

extract_pump.buffer('output').on('end', function (data) {
    console.log("output buffer has ended")
});

var transform_pump = new datapumps.Pump();

extract_pump
    .from(extract_input_buffer)
    .to(transform_pump, 'output')
    .logErrorsToConsole()

transform_pump

    .logErrorsToConsole()

.whenFinished().then(function() {
console.log('Pumps processed.');
});

pump_group.addPump('extract_pump');
pump_group.addPump('transform_pump');


pump_group.start().debug();

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions