You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+9-9Lines changed: 9 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -32,25 +32,25 @@ This is made forLaravel Octane compatibility.
32
32
33
33
#### Setting initial event
34
34
35
-
You typically create a new initial event when you receive a HTTP request coming from a client you do not own. E.g in an API Gateway.
36
-
There is a built-in `Ensi\LaravelInitialEventPropagation\SetInitialEventHttpMiddleware` for that.
37
-
It creates an `InitialEventDTO` and places it to the `InitialEventHolder` singleton.
35
+
You typically create a new initial event when you receive a HTTP request coming from a client you do not own. E.g in an API Gateway.
36
+
There is a built-in `Ensi\LaravelInitialEventPropagation\SetInitialEventHttpMiddleware` for that.
37
+
It creates an `InitialEventDTO` and places it to the `InitialEventHolder` singleton.
38
38
-`userId` and `entrypoint` are set from request.
39
39
-`app` is set according to config options.
40
40
-`userType` is set from the package config. `userType` is empty for a not authenticated user.
41
41
-`correlationId` and `timestamp` are set from request headers according to config options or generated from scratch.
42
42
-`realUserId`, `realUserType` and `misc` are left empty strings.
43
43
44
-
Be sure to add the midlleware AFTER Laravel middleware that sets authenticated user.
44
+
Be sure to add the midlleware AFTER Laravel middleware that sets authenticated user.
45
45
In practice it likely means that you have to place the middleare at the very bottom of `middlewareGroups` in `app/Http/Kernel`
46
46
47
47
#### Parsing incoming initial event
48
48
49
-
Add `Ensi\LaravelInitialEventPropagation\ParseInitialEventHeaderMiddleware` to `app/Http/Kernel` middleware property.
49
+
Add `Ensi\LaravelInitialEventPropagation\ParseInitialEventHeaderMiddleware` to `app/Http/Kernel` middleware property.
50
50
This middleware parses `X-Initial-Event` HTTP header, deserializes it into `InitialEventDTO` object and places it to the `InitialEventHolder` singleton.
51
51
52
52
#### Propagating initial event to outcomming HTTP request
53
-
The package provides a `Ensi\LaravelInitialEventPropagation\PropagateInitialEventLaravelGuzzleMiddleware` Guzzle Middleware that converts ` resolve(InitialEventHolder::class)->getInitialEvent()` back to `X-Initial-Event` header and sets this header for all outcomming guzzle request.
53
+
The package provides a `Ensi\LaravelInitialEventPropagation\PropagateInitialEventLaravelGuzzleMiddleware` Guzzle Middleware that converts ` resolve(InitialEventHolder::class)->getInitialEvent()` back to `X-Initial-Event` header and sets this header for all outcomming guzzle request.
54
54
55
55
You can add it to your guzzle stack like this:
56
56
@@ -73,13 +73,13 @@ public function bootstrap()
73
73
(new SetInitialEventArtisanMiddleware())->handle();
74
74
}
75
75
```
76
-
This middleware sets artisan command name (including argument, excluding options) as `$initialEventDTO->entrypoint`.
77
-
If your custom artisan command makes guzzle HTTP requests to other apps the `PropagateInitialEventGuzzleMiddleware` uses this initial event.
76
+
This middleware sets artisan command name (including argument, excluding options) as `$initialEventDTO->entrypoint`.
77
+
If your custom artisan command makes guzzle HTTP requests to other apps the `PropagateInitialEventGuzzleMiddleware` uses this initial event.
78
78
This middleware also works fine for [Laravel Task Scheduling](https://laravel.com/docs/latest/scheduling).
79
79
80
80
#### Queue Jobs
81
81
82
-
You typically want to persist initial event between incoming HTTP request and queued job.
82
+
You typically want to persist initial event between incoming HTTP request and queued job.
83
83
The package can help you here aswell. Unfortunately you need to touch a given job:
0 commit comments