Skip to content

Commit

Permalink
Added failswitch parameter for subscribe
Browse files Browse the repository at this point in the history
  • Loading branch information
andot committed Aug 24, 2016
1 parent 9576431 commit 6fe074c
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/Hprose/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* *
* hprose client class for php 5.3+ *
* *
* LastModified: Aug 8, 2016 *
* LastModified: Aug 24, 2016 *
* Author: Ma Bingyao <[email protected]> *
* *
\**********************************************************/
Expand Down Expand Up @@ -614,9 +614,9 @@ public function getId() {
$this->topics[$name] = array();
}
}
// subscribe($name, $callback, $timeout)
// subscribe($name, $id, $callback, $timeout)
public function subscribe($name, $id = null, $callback = null, $timeout = null) {
// subscribe($name, $callback, $timeout, $failswitch)
// subscribe($name, $id, $callback, $timeout, $failswitch)
public function subscribe($name, $id = null, $callback = null, $timeout = null, $failswitch = false) {
$self = $this;
if (!is_string($name)) {
throw new TypeError('topic name must be a string');
Expand All @@ -633,8 +633,8 @@ public function subscribe($name, $id = null, $callback = null, $timeout = null)
if ($this->id == null) {
$this->id = $this->autoId();
}
$this->id->then(function($id) use ($self, $name, $callback, $timeout) {
$self->subscribe($name, $id, $callback, $timeout);
$this->id->then(function($id) use ($self, $name, $callback, $timeout, $failswitch) {
$self->subscribe($name, $id, $callback, $timeout, $failswitch);
});
return;
}
Expand All @@ -644,7 +644,7 @@ public function subscribe($name, $id = null, $callback = null, $timeout = null)
$topic = new stdClass();
$settings = new InvokeSettings(array(
'idempotent' => true,
'failswitch' => false,
'failswitch' => $failswitch,
'timeout' => $timeout
));
$cb = function() use ($self, &$cb, $topic, $name, $id, $settings) {
Expand Down

0 comments on commit 6fe074c

Please sign in to comment.