Download the PHP package 3slab/vdm-library-http-transport-bundle without Composer
On this page you can find all versions of the php package 3slab/vdm-library-http-transport-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download 3slab/vdm-library-http-transport-bundle
More information about 3slab/vdm-library-http-transport-bundle
Files in 3slab/vdm-library-http-transport-bundle
Package vdm-library-http-transport-bundle
Short Description Vdm Http Transport
License proprietary
Informations about the package vdm-library-http-transport-bundle
VdmLibrary messenger HTTP transport
This symfony messenger extension provides a transport to pull data from a HTTP source.
Installation
Configuration reference
Configuration | Description |
---|---|
dsn | the url you want to collect (needs to start by http or https) |
retry_strategy.max_retries | needs to be 0 because http transport does not support this feature |
options.method | HTTP method to be called |
options.http_options | options supported on request by the symfony http client |
options.http_executor | set the id (in the container of services) of a custom http executor to use instead of the DefaultHttpExecutor |
options.monitoring.enabled | if true, hook up in the vdm library bundle monitoring system to send information about the HTTP response |
options.retry.enabled | if true, retry an http call in case of error |
options.retry.number | number of time to retry before stopping with error |
options.retry.timeBeforeRetry | time in second between each try (multiplied by the current retry number to delay) |
HTTP Executor
HTTP executor allows you to customize the behavior of the HTTP transport per transport definition inside your messenger.yaml
file.
Some example use cases are that the API has a pagination or needs a pre-request for authentication.
If you don't set a custom http_executor
option when declaring the transport, the default DefaultHttpExecutor is used
which just calls the API using the default Symfony http client with the method
and http_options
you have configured.
You can override this behavior in your project by providing a class that extends Vdm\Bundle\LibraryBundle\Executor\Http\AbstractHttpExecutor
.
There are 2 important things your custom executor needs to do :
yield
a new envelope- Add a
StopAfterHandleStamp
stamp to the yielded envelope if you want to stop after handling the last message (if not, the messenger worker may loop over and will execute it once again without stopping)
Note : thanks to the yield system, you can implement a loop in your execute function and return items once at a time
Note : you can keep state in your custom executor so if it is executed again, adapt your API call
Then references this custom executor in your transport definition in your project messenger.yaml
:
Monitoring
If you enable monitoring, it will track the following metrics :
- Counter on the HTTP response status code
- Size of the HTTP response body
- The HTTP response time