generated from spiral-packages/package-skeleton
-
-
Notifications
You must be signed in to change notification settings - Fork 5
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
Showing
10 changed files
with
379 additions
and
321 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
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,60 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Spiral\TemporalBridge\Config; | ||
|
||
use Temporal\Client\ClientOptions; | ||
use Temporal\Client\GRPC\Context; | ||
use Temporal\Client\GRPC\ContextInterface; | ||
|
||
/** | ||
* Temporal Client configuration. | ||
* | ||
* ClientConfig::new( | ||
* ConnectionConfig::new('localhost:7233') | ||
* ->withTls( | ||
* privateKey: '/my-project.key', | ||
* certChain: '/my-project.pem', | ||
* ), | ||
* (new ClientOptions()) | ||
* ->withNamespace('default'), | ||
* Context::default() | ||
* ->withTimeout(4.5) | ||
* ->withRetryOptions( | ||
* RpcRetryOptions::new() | ||
* ->withMaximumAttempts(5) | ||
* ->withInitialInterval(3) | ||
* ->withMaximumInterval(10) | ||
* ->withBackoffCoefficient(1.6) | ||
* ), | ||
* ), | ||
* ), | ||
*/ | ||
final class ClientConfig | ||
{ | ||
private function __construct( | ||
public readonly ConnectionConfig $connection, | ||
public readonly ClientOptions $options, | ||
public readonly ContextInterface $context, | ||
) {} | ||
|
||
/** | ||
* Create a new client configuration. | ||
* | ||
* @param ConnectionConfig $connection | ||
* @param ClientOptions|null $options | ||
* @param ContextInterface|null $context Default Service Client context. | ||
*/ | ||
public static function new( | ||
ConnectionConfig $connection, | ||
?ClientOptions $options = null, | ||
?ContextInterface $context = null, | ||
): self { | ||
return new self( | ||
$connection, | ||
$options ?? new ClientOptions(), | ||
$context ?? Context::default(), | ||
); | ||
} | ||
} |
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
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
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
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
Oops, something went wrong.