@@ -7,10 +7,10 @@ The **SchemaContextBundle** provides a lightweight way to manage dynamic schema
77## Features
88
99- Extracts tenant schema param from baggage request header.
10- - Stores schema context in a global ` SchemaResolver ` .
11- - Injects schema info into Messenger messages via a middleware.
12- - Rehydrates schema on message consumption via a middleware.
13- - Provide decorator for Http clients to propagate schema header
10+ - Stores schema and baggage context in a global ` BaggageSchemaResolver ` .
11+ - Injects schema and baggage info into Messenger messages via a middleware.
12+ - Rehydrates schema and baggage on message consumption via a middleware.
13+ - Provide decorator for Http clients to propagate baggage header
1414
1515---
1616
@@ -49,34 +49,35 @@ APP_NAME=develop
4949## Usage
5050
5151``` php
52- use Macpaw\SchemaContextBundle\Service\SchemaResolver ;
52+ use Macpaw\SchemaContextBundle\Service\BaggageSchemaResolver ;
5353
54- public function index(SchemaResolver $schemaResolver)
54+ public function index(BaggageSchemaResolver $schemaResolver)
5555{
5656 $schema = $schemaResolver->getSchema();
57+ $baggage = $schemaResolver->getBaggage();
5758 // Use schema in logic
5859}
5960```
6061
61- ## Schema -Aware HTTP Client
62+ ## Baggage -Aware HTTP Client
6263Decorate your http client in your service configuration:
6364``` yaml
6465services :
65- schema_aware_payment_http_client :
66- class : Macpaw\SchemaContextBundle\HttpClient\SchemaAwareHttpClient
66+ baggage_aware_payment_http_client :
67+ class : Macpaw\SchemaContextBundle\HttpClient\BaggageAwareHttpClient
6768 decorates : payment_http_client # http client to decorate
6869 arguments :
69- - ' @schema_aware_payment_http_client .inner'
70- - ' @Macpaw\SchemaContextBundle\Service\SchemaResolver '
71- - ' %schema_context.header_name% '
70+ - ' @baggage_aware_payment_http_client .inner'
71+ - ' @Macpaw\SchemaContextBundle\Service\BaggageSchemaResolver '
72+ - ' @Macpaw\SchemaContextBundle\Service\BaggageCodec '
7273` ` `
7374
7475## Messenger Integration
7576The bundle provides a middleware that automatically:
7677
77- * Adds a SchemaStamp to dispatched messages
78+ * Adds a BaggageSchemaStamp to dispatched messages
7879
79- * Restores the schema context on message handling
80+ * Restores the schema and baggage context on message handling
8081
8182Enable the middleware in your ` messenger.yaml`:
8283
@@ -86,7 +87,7 @@ framework:
8687 buses:
8788 messenger.bus.default:
8889 middleware:
89- - Macpaw\S chemaContextBundle\M essenger\M iddleware\S chemaMiddleware
90+ - Macpaw\S chemaContextBundle\M essenger\M iddleware\B aggageMiddleware
9091` ` `
9192
9293# # Testing
@@ -100,4 +101,3 @@ Feel free to open issues and submit pull requests.
100101
101102# # License
102103This bundle is released under the MIT license.
103-
0 commit comments