dis+/node_modules/@google-cloud/pubsub/build/src/publisher/message-queues.js
/**
     * Accepts a batch of messages and publishes them to the API.
     *
     * @param {object[]} messages The messages to publish.
     * @param {PublishCallback[]} callbacks The corresponding callback functions.
     * @param {function} [callback] Callback to be fired when publish is done.
     */
Accepts a batch of messages and publishes them to the API.
@param {object[]} messages The messages to publish.
@param {PublishCallback[]} callbacks The corresponding callback functions.
@param {function} [callback] Callback to be fired when publish is done.
Accepts a batch of messages and publishes them to the API . @param { object [] } messages The messages to publish . @param { PublishCallback [] } callbacks The corresponding callback functions . @param { function } [ callback ] Callback to be fired when publish is done .
_publish(messages, callbacks, callback) {
        const { topic, settings } = this.publisher;
        const reqOpts = {
            topic: topic.name,
            messages,
        };
        if (messages.length === 0) {
            if (typeof callback === 'function') {
                callback(null);
            }
            return;
        }
        topic.request({
            client: 'PublisherClient',
            method: 'publish',
            reqOpts,
            gaxOpts: settings.gaxOpts,
        }, (err, resp) => {
            const messageIds = (resp && resp.messageIds) || [];
            callbacks.forEach((callback, i) => callback(err, messageIds[i]));
            if (typeof callback === 'function') {
                callback(err);
            }
        });
    }
_publish ( messages , callbacks , callback ) { const { topic , settings } = this . publisher ; const reqOpts = { topic : topic . name , messages , } ; if ( messages . length === 0 ) { if ( typeof callback === 'function' ) { callback ( null ) ; } return ; } topic . request ( { client : 'PublisherClient' , method : 'publish' , reqOpts , gaxOpts : settings . gaxOpts , } , ( err , resp ) => { const messageIds = ( resp && resp . messageIds ) || [ ] ; callbacks . forEach ( ( callback , i ) => callback ( err , messageIds [ i ] ) ) ; if ( typeof callback === 'function' ) { callback ( err ) ; } } ) ; }
Accepts a batch of messages and publishes them to the API.
Accepts a batch of messages and publishes them to the API .