Add support for http-interop/http-middleware 0.5
- Fix another issue with validating Docker IP :D.
- Fix an issue with validating Docker IP detection.
- Fix an issue with the
SilentFailingListener
.
- Dependency has been bumped to PHP 7.1.
- A new
DelayedMessageInterface
has now been added. - Support for FIFO queues has been added.
- If you return any 2xx from your worker middleware (like 204), it will now be transformed as 200 before being returned to Elastic Beanstalk, so that those messages are also deleted from the queue. Previously, returning a 204 would retry the job.
- [BC break] Middlewares are now compatible with latest HTTP middlewares interfaces.
- [BC break] You cannot any longer map multiple middlewares to a single event name. It introduced a lot of complexities to the code and does not map well to the new approach of middlewares. A better approach now is to use a command bus mechanism to dispatch to multiple handlers.
- [BC break]
LocalhostCheckerMiddleware
has been removed. Now, all the security checks are done within theWorkerMiddleware
. Especially, in addition of the previous security check that enforced the request to come from localhost, we now also check the user agent to verify the request originated from Amazon. - [BC break] Worker route is not added automatically anymore. You will need to manually attach the middleware to the path of your choice.
- [BC break] The structure of messages has been modified. Previously, a message was encoded this way:
{
"name": "message_name",
"payload": {
"id": "123",
"other": "value"
}
}
Now, message body only contain the message content itself:
{
"id": "123",
"other": "value"
}
This allows for simpler messages, and prevent parsing the body to get the message name. The message name is now added through a "message attribute" called "Name".
When a message is pushed by EC2 instances, the SQSD daemon automatically creates headers with the message attributes. In our case, the daemon automatically
adds a header called X-Aws-Sqsd-Attr-Name
that contains the message name, which is read by the worker to redirect to the proper listeners.
This has two major consequences:
-
Messages created using an older version won't be read by the newer version of the worker. This means that you'll need to deploy both your producer and consumer applications at the same time to minimize the problems. Once your consumer has been deployed, it may still received some messages coming in the old format (those created before the deployment). We recommend you to setup a dead letter queue to be able to gracefully retry your messages after.
-
Because of the use of SQS attributes, you cannot any longer use this version with old Elastic Beanstalk environments. We therefore recommend you to update your worker environments to a 2016 IAM or later so that the daemon properly redirects the attributes.
- Add support for periodic tasks
- Always add a
X-Handled-By
to the response at the end of the worker pipeline. This allows to make sure that the original response is modified, as some middleware frameworks likeZend\Expressive
returns a 404 if the response has not been modified at all. [#31] - Worker middleware can be simplified to only have
ServerRequestInterface
as unique parameter. [#30]
- Fixed a bug that prevented worker middleware to work properly when localhost checker middleware was used
- Adds support for detecting localhost requests coming from Docker environment
- ZfrEbWorker adds a new security improvement by restricting the internal worker to localhost only.
- Now uses
Zend\ComponentInstaller
for config
- Add missing factory for
SilentFailingListener
.
- Message body is now encoded in RFC4627-compliant JSON by using some encoding flags.
QueuePublisherInterface
has been removed and replaced by a singleMessageQueueInterface
, tied to a single queue.- A new
MessageQueueRepositoryInterface
has been introduced to allow fetching message queues by name. - Added a new
Message
andDelayedMessage
abstraction for easier creation of messages.
- Add a new
SilentFailingListener
class that you can use if you don't want to handle a specific message. - Add a CLI command that simulate locally the Elastic Beanstalk worker. This new worker should only be used for development, never in production.
- Add a CLI command that allows to easily push messages to a given queue which respects the ZfrEbWorker structure.
- Deprecate the
AppConfig
configuration provider, useModuleConfig
instead (for better reflect distinction between app and reusable code).
- Add new constants for request attributes.
- Add a new optional argument to
flush
method that allows to flush the queue asynchronously (ideal when you want to reduce latency). - Allow to set multiple middlewares for a given message (see documentation).
- Naming was (again, sorry...) changed to better reflect usage. Especially:
- In the message added to SQS,
task_name
was renamedname
, andattributes
was renamedpayload
. - In the configuration, config key
tasks
was renamedmessages
- In the request, message payload is now retrieved using
worker.message_payload
key, while message name is retrieved usingworker.message_name
key.
- In the message added to SQS,
- Add a new
setQueue
method toQueuePublisherInterface
to add new queues at runtime.
- Use
require_once
instead ofinclude_once
forAppConfig
.
- Fix the
AppConfig
path.
- Add a
QueuePublisherInterface
key as alias, that maps to the concrete implementation for cleaner re-usability.
- Add the attribute
worker.task_name
to the request attribute
jobs
were renamedtasks
to be on-par with Elastic Beanstalk worker terminology.
- [BC]
WorkerMiddleware
has been moved to its own namespace. You should not have any problem unless you were explicitly extending the middleware.
- Update PHPUnit dependency for better PHP7 support
- Fix directory for Container tests
- Ensure that messages are not duplicated by clearing the message on flush
- Fix typo in exception error message
- Initial release