Types
Consumer Types (based on Guzzle 6) are responsible for grouping events and processing both the outgoing requests and incoming responses. It offers the possibility to send specific headers or to write down individual / specific middleware.
Register a new Type
The default Type will be used if no type attribute is defined.
Configuration
Optionally you can use adjustable system configuration within a custom Consumer Type. You can find these settings within Stores > Configuration > Services >MageHook > Consumer Types.
Custom configuration
The second Group id
attribute corresponds together with the CONFIG_GROUP
constant which can optionally be defined in your custom Consumer Type class.
Simply call the getSystemConfig()
method in order to use those values within your custom Consumer Type. Please be aware that the 'default' consumer type configuration will always be merged. These can be simply overwritten by using the same field id within your system.xml.
Type Middleware
Type Middleware gives you the richness to circle around the request and response cycle. It's based on the Guzzle 6 Middleware layer and can be used real easily.
Push a global Middleware
Push a Middleware into a specific Type
Middleware will always be pushed on top of the default Stack. You are able to sit in front or after a specific Middleware by using $stack->before()
or $stack->after()
within a Plugin on the public abstract prepareMiddleware()
method.
Type module development
A basic set of rules are applied in order to keep things readable.
Always use a HookType prefix
Type modules can possess events
Use readable namespaces
Last updated