Loading TOC...

MarkLogic 9 Product Documentation
flexrep.configurationTargetSetImmediatePush

flexrep.configurationTargetSetImmediatePush(
   cfg as element(flexrep.configuration),
   target-id as (Number|String),
   immediate-push as Boolean
) as element(flexrep.configuration)

Summary

Set a target's "immediate push" flag. This defaults to true when a target is created. Normally, when a document is created or updated, flexrep will attempt to replicate it to all push targets from a single CPF action, and a single database transaction. When many targets are configured, there is a danger that this transaction will run for a long time and eventually time out. The "immmediate push" flag allows control over which targets should have documents replicated immediately, and which targets should have them replicated via the periodic retry scheduled task.

Query-based targets are always handled by the periodic retry scheduled task.

Parameters
cfg The replication configuration.
target-id The target ID.
immediate-push True if the target should attempt to push from the CPF action, false if it should only be pushed from the retry task.

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 cfg = flexrep.configurationGet(domain, true);
  const targetId = flexrep.configurationTargetGetId(cfg, 'Replica');

  flexrep.configurationInsert(
    flexrep.configurationTargetSetImmediatePush(
      cfg, targetId, false));
   

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