-
Notifications
You must be signed in to change notification settings - Fork 107
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e450c7e
commit 8b22559
Showing
5 changed files
with
84 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
src/rpc-client/test/Testing/Clients/Demo8098ServiceClient.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?php | ||
namespace SwoftTest\Rpc\Testing\Clients; | ||
|
||
use Swoft\Bean\Annotation\Bean; | ||
use Swoft\Rpc\Client\Bean\Annotation\Reference; | ||
use SwoftTest\Rpc\Testing\Lib\DemoServiceInterface; | ||
|
||
/** | ||
* Class DemoServiceClient | ||
* @Bean | ||
* @method version | ||
* @method longMessage($string) | ||
* @method get($id) | ||
*/ | ||
class Demo8098ServiceClient | ||
{ | ||
/** | ||
* @Reference(name="service.demo.8098", fallback="demoFallback", breaker="breaker") | ||
* @var DemoServiceInterface | ||
*/ | ||
protected $demoService; | ||
|
||
public function __call($name, $arguments) | ||
{ | ||
return $this->demoService->$name(...$arguments); | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
src/rpc-client/test/Testing/Pool/Config/Demo8098ServicePoolConfig.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?php | ||
namespace SwoftTest\Rpc\Testing\Pool\Config; | ||
|
||
use Swoft\Bean\Annotation\Bean; | ||
use Swoft\Bean\Annotation\Value; | ||
use Swoft\Pool\PoolProperties; | ||
|
||
/** | ||
* Class DemoServicePoolConfig | ||
* @Bean | ||
* @package SwoftTest\Rpc\Client\Testing\Pool\Config | ||
*/ | ||
class Demo8098ServicePoolConfig extends PoolProperties | ||
{ | ||
protected $name = 'service.demo.8098'; | ||
|
||
protected $uri = [ | ||
'127.0.0.1:8098' | ||
]; | ||
|
||
/** | ||
* Connection timeout | ||
* | ||
* @var int | ||
*/ | ||
protected $timeout = 1; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?php | ||
namespace SwoftTest\Rpc\Testing\Pool; | ||
|
||
use Swoft\Bean\Annotation\Inject; | ||
use Swoft\Bean\Annotation\Pool; | ||
use Swoft\Rpc\Client\Pool\ServicePool as SwoftServicePool; | ||
use SwoftTest\Rpc\Testing\Pool\Config\Demo8098ServicePoolConfig; | ||
use SwoftTest\Rpc\Testing\Pool\Config\DemoServicePoolConfig; | ||
|
||
/** | ||
* Class DemoServicePool | ||
* @Pool(name="service.demo.8098") | ||
* @package SwoftTest\Rpc\Testing\Pool | ||
*/ | ||
class Demo8098ServicePool extends SwoftServicePool | ||
{ | ||
/** | ||
* @Inject | ||
* @var Demo8098ServicePoolConfig | ||
*/ | ||
protected $poolConfig; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters