Loading TOC...

flexrep.configurationTargetSetDocumentsPerBatch

flexrep.configurationTargetSetDocumentsPerBatch(
   cfg as element(flexrep.configuration),
   target-id as (Number|String),
   val as Number
) as element(flexrep.configuration)

Summary

This function sets the documents-per-batch value for the specified replication target.

Parameters
cfg The replication configuration.
target-id The ID of the replication target.
val The number of documents to be replicated in each batch.

Example

const flexrep = require('/MarkLogic/flexrep');

  declareUpdate();
  // Obtain the domain ID from the database used by the Master to enable CPF.
  const domain = xdmp.eval(
    'const dom = require("/MarkLogic/cpf/domains");' +
      'fn.data(dom.get("Default Master").xpath("//dom:domain-id"));',
       null,
         {
          'database' : xdmp.database('Triggers')
         });

  const config = flexrep.configurationGet(domain, true);
  const targetId = flexrep.configurationTargetGetId(config, 'Replica');

  const cfg = 
      flexrep.configurationTargetSetDocumentsPerBatch(config, targetId, 20);

  flexrep.configurationInsert(cfg);

  // Sets the replicated documents-per-batch setting for the 'Replica' 
  // target to 20.
      
   

Stack Overflow iconStack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.