v4.0.0-alpha2
Pre-releaseInterceptors
Full integration with interceptors of Spiral v3.14.
In interceptors, you can interact with the request context, modify the input, handle the output, and perform any actions just before calling the target method.
Container Scopes
Added support for container scopes. Each worker will open the corresponding scopes immediately after initialization (dispatcher scope) and before running interceptors (context scope).
Dispatcher scopes are used to limit service bindings. Contextu scopes limits the context. For example, in the HTTP module, the context is ServerRequestInterface from PSR-7. Corresponding contexts have been added for the others as well.
HTTP:
http- dispatcher scopehttp-request- context scope\Psr\Http\Message\ServerRequestInterface- context class
Centrifugo:
centrifugo- dispatcher scopecentrifugo-request- context scope\RoadRunner\Centrifugo\Request\RequestInterface- context class
gRPC (server):
grpc- dispatcher scopegrpc-request- context scope\Spiral\RoadRunnerBridge\GRPC\UnaryCallInterface- context class
Queue:
queue- dispatcher scopequeue-task- context scope\Spiral\Queue\TaskInterface- context class
TCP:
tcp- dispatcher scopetcp-request- context scope\Spiral\RoadRunner\Tcp\RequestInterface- context class
gRPC
Performance
The worker initialization time has been significantly optimized by using
tokenizer listeners
when searching for gRPC services.
Client
The responsibility for making client gRPC calls has been moved to the spiral/grpc-client package, which is included by default.
Generating client classes is no longer required, as spiral/grpc-client generates the necessary proxy classes at runtime.
That's why all the extra generators (BootloaderGenerator, ConfigGenerator, ClientGenerator) and client-related classes have been removed from this package.
To configure spiral/grpc-client, a client section has been added to the gRPC configuration:
return [
// File 'app/config/grpc.php'
// ... other options ...
'client' => new GrpcClientConfig(
interceptors: [
SetTimoutInterceptor::createConfig(6_000),
RetryInterceptor::createConfig(
maximumAttempts: 1,
),
ExecuteServiceInterceptors::class,
],
services: [
new \Spiral\Grpc\Client\Config\ServiceConfig(
connections: ConnectionConfig::createInsecure('localhost:9001'),
interfaces: [
\GRPC\Mailer\MailerServiceInterface::class,
\GRPC\Mailer\PingerServiceInterface::class,
],
),
],
)
];Refer to the spiral/grpc-client documentation for more information.