<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/ref.zookeeper.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'fr',
  ),
  'this' => 
  array (
    0 => 'function.zookeeper-dispatch.php',
    1 => 'zookeeper_dispatch',
    2 => 'Appelle les fonctions de rappels pour les op&eacute;rations en attente',
  ),
  'up' => 
  array (
    0 => 'ref.zookeeper.php',
    1 => 'Fonctions ZooKeeper',
  ),
  'prev' => 
  array (
    0 => 'ref.zookeeper.php',
    1 => 'Fonctions ZooKeeper',
  ),
  'next' => 
  array (
    0 => 'class.zookeeper.php',
    1 => 'Zookeeper',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'fr',
    'path' => 'reference/zookeeper/functions/zookeeper_dispatch.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.zookeeper-dispatch" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">zookeeper_dispatch</h1>
  <p class="verinfo">(PECL zookeeper &gt;= 0.4.0)</p><p class="refpurpose"><span class="refname">zookeeper_dispatch</span> &mdash; <span class="dc-title">Appelle les fonctions de rappels pour les opérations en attente</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-function.zookeeper-dispatch-description">
  <h3 class="title">Description</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>zookeeper_dispatch</strong></span>(): <span class="type"><a href="language.types.void.php" class="type void">void</a></span></div>


  <p class="para rdfs-comment">
   La fonction <span class="function"><strong>zookeeper_dispatch()</strong></span> appelle les fonctions de rappels passées par les opérations comme <span class="methodname"><a href="zookeeper.get.php" class="methodname">Zookeeper::get()</a></span> ou <span class="methodname"><a href="zookeeper.exists.php" class="methodname">Zookeeper::exists()</a></span>.
  </p>

  <div class="caution"><strong class="caution">Attention</strong>
   <p class="para">
    Depuis la version 0.4.0, cette fonction doit être appelée manuellement pour réaliser des opérations asynchrones. Pour que cela soit fait automatiquement, il est également possible de déclarer des ticks au début du programme.
   </p>
  </div>

  <p class="para">
   Après PHP 7.1, il est possible d&#039;ignorer cette fonction. Cette extension utilise EG(vm_interrupt) pour implémenter la répartition asynchrone.
  </p>

 </div>


 <div class="refsect1 parameters" id="refsect1-function.zookeeper-dispatch-parameters">
  <h3 class="title">Liste de paramètres</h3>
  <p class="para">Cette fonction ne contient aucun paramètre.</p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.zookeeper-dispatch-returnvalues">
  <h3 class="title">Valeurs de retour</h3>
  <p class="para">
   Aucune valeur n&#039;est retournée.
  </p>
 </div>


 <div class="refsect1 errors" id="refsect1-function.zookeeper-dispatch-errors">
  <h3 class="title">Erreurs / Exceptions</h3>
  <p class="para">
   Cette méthode émet une alerte PHP lorsque la fonction de rappel ne peut pas être invoquée.
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-function.zookeeper-dispatch-examples">
  <h3 class="title">Exemples</h3>
  <div class="example" id="function.zookeeper-dispatch.example.1">
   <p><strong>Exemple #1 Exemple de <span class="methodname"><strong>zookeeper_dispatch()</strong></span> #1</strong></p>
   <div class="example-contents"><p>
     Répartir manuellement les fonctions de rappels.
   </p></div>
   <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br />$client </span><span style="color: #007700">= new </span><span style="color: #0000BB">Zookeeper</span><span style="color: #007700">();<br /></span><span style="color: #0000BB">$client</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">connect</span><span style="color: #007700">(</span><span style="color: #DD0000">'localhost:2181'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$client</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">get</span><span style="color: #007700">(</span><span style="color: #DD0000">'/zookeeper'</span><span style="color: #007700">, function() {<br />    echo </span><span style="color: #DD0000">"Callback was called"</span><span style="color: #007700">.</span><span style="color: #0000BB">PHP_EOL</span><span style="color: #007700">;<br />});<br />while(</span><span style="color: #0000BB">true</span><span style="color: #007700">) {<br />    </span><span style="color: #0000BB">sleep</span><span style="color: #007700">(</span><span style="color: #0000BB">1</span><span style="color: #007700">);<br />    </span><span style="color: #0000BB">zookeeper_dispatch</span><span style="color: #007700">();<br />}<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
   </div>

  </div>

  <div class="example" id="function.zookeeper-dispatch.example.2">
   <p><strong>Exemple #2 Exemple de <span class="methodname"><strong>zookeeper_dispatch()</strong></span> #2</strong></p>
   <div class="example-contents"><p>
     Déclarer des ticks.
   </p></div>
   <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br /></span><span style="color: #007700">declare(</span><span style="color: #0000BB">ticks</span><span style="color: #007700">=</span><span style="color: #0000BB">1</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">$client </span><span style="color: #007700">= new </span><span style="color: #0000BB">Zookeeper</span><span style="color: #007700">();<br /></span><span style="color: #0000BB">$client</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">connect</span><span style="color: #007700">(</span><span style="color: #DD0000">'localhost:2181'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$client</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">get</span><span style="color: #007700">(</span><span style="color: #DD0000">'/zookeeper'</span><span style="color: #007700">, function() {<br />    echo </span><span style="color: #DD0000">"Callback was called"</span><span style="color: #007700">.</span><span style="color: #0000BB">PHP_EOL</span><span style="color: #007700">;<br />});<br />while(</span><span style="color: #0000BB">true</span><span style="color: #007700">) {<br />    </span><span style="color: #0000BB">sleep</span><span style="color: #007700">(</span><span style="color: #0000BB">1</span><span style="color: #007700">);<br />}<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
   </div>

  </div>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.zookeeper-dispatch-seealso">
  <h3 class="title">Voir aussi</h3>
  <p class="para">
   <ul class="simplelist">
    <li><span class="methodname"><a href="zookeeper.addauth.php" class="methodname" rel="rdfs-seeAlso">Zookeeper::addAuth()</a> - Sp&eacute;cifie les informations d'authentification de l'application</span></li>
    <li><span class="methodname"><a href="zookeeper.connect.php" class="methodname" rel="rdfs-seeAlso">Zookeeper::connect()</a> - Cr&eacute;er une connexion pour communiquer avec Zookeeper</span></li>
    <li><span class="methodname"><a href="zookeeper.construct.php" class="methodname" rel="rdfs-seeAlso">Zookeeper::__construct()</a> - Cr&eacute;er une connexion pour communiquer avec Zookeeper</span></li>
    <li><span class="methodname"><a href="zookeeper.exists.php" class="methodname" rel="rdfs-seeAlso">Zookeeper::exists()</a> - V&eacute;rifie l'existence d'un n&oelig;ud de mani&egrave;re synchrone</span></li>
    <li><span class="methodname"><a href="zookeeper.get.php" class="methodname" rel="rdfs-seeAlso">Zookeeper::get()</a> - Renvoie les donn&eacute;es associ&eacute;es &agrave; un n&oelig;ud de mani&egrave;re synchrone</span></li>
    <li><span class="methodname"><a href="zookeeper.getchildren.php" class="methodname" rel="rdfs-seeAlso">Zookeeper::getChildren()</a> - Liste les enfants d'un n&oelig;ud de mani&egrave;re synchrone</span></li>
    <li><span class="methodname"><a href="zookeeper.setwatcher.php" class="methodname" rel="rdfs-seeAlso">Zookeeper::setWatcher()</a> - D&eacute;finit une fonction d'observation</span></li>
   </ul>
  </p>
 </div>


</div><?php manual_footer($setup); ?>