prooph / psr7-middleware

Consume prooph messages with a PSR7 middleware
http://getprooph.org/
BSD 3-Clause "New" or "Revised" License
14 stars 8 forks source link

Add possibility to get metadata from request #6

Closed codeliner closed 8 years ago

codeliner commented 8 years ago

It could be useful to get specific metadata from the psr7 request and create a command/event/query using the metadata. One example is an identity value object which was added by an authentication middleware to the request as an attribute.

One option would be to inject a "MetadataGatherer" (maybe optional dependency or a noop default) to each message handling middleware. The creation of a message could then look something like this:

$query = $this->queryFactory->createMessageFromArray($queryName, [
  'payload' => $payload,
  'metadata' => $this->metadataGatherer->getFromRequest($request),
]);
basz commented 8 years ago

I kind of need this now. How can I help get this realised?

I see what a'metadataGatherer would do. I think I could create this, no one is working on this and a PR would be accepted?

codeliner commented 8 years ago

@basz PR would be great.

basz commented 8 years ago

Allready started

codeliner commented 8 years ago

Added with #7