Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Messenger] Add the transports documentation #9756

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 4 commits into from

Conversation

sroze
Copy link
Contributor

@sroze sroze commented May 10, 2018

Add the Messenger transports documentation. Does not aim to be exhaustive but give more details.

One little thing... we wait for this one to be merged: symfony/symfony#27008

$this->toEmail = $toEmail;
}

public function send($message)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be updated according to the current contract, Envelope $... ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See #9757


class YourTransport implements TransportInterface
{
public function send($message) : void
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here.


First, create your sender::

namespace App\MessageSender;
Copy link
Member

@yceruto yceruto May 10, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could go suggesting a better structure for Messenger stuff? maybe App\Message\Sender or App\Messenger\Transport instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, why not 👍

~~~~~~~~~~~~~~

If something wrong happens (i.e. an exception is thrown) while handling your message,
the default behaviour is that your message will be "NACK" and requeued.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Who is NACK? It sounds mean :).

Seriously, as someone not too familiar with this stuff, is NACK an "action". Like, a "message is NACKed"? OR, something different?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not Acknowledge. Do you have any idea on how to phrase it differently? 🤷‍♂️

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Beginning with this, i'll explain this like : Not Acknowledge = not treated and requeued.

Retry
~~~~~

When receiving messages from a broker, it might happen that some exceptions will
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not clear what this means. Do you mean, when my app is handling a message (that just came from a broker), it could fail (e.g. DB exception, or my handler throws an exception)? Or, are you talking about some sort of communication error from the broker?

the first failure, it will wait 10 seconds before trying it. After the 2nd failure,
it will wait 30 seconds. After the 3rd failure, it will wait a minute. If it still
fails, the message will be moved to a "dead queue" and you will have to manually
handle this message.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you just define a single TTL to be used for each retry? Or is there a default?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are to be removed as retry wasn't merged in.

When receiving messages from a broker, it might happen that some exceptions will
arise. Typically, a 3rd party provider is down or your system is under heavy load
and can't really process some messages. To handle this scenario, there is a built-in
retry mechanism that can be enabled via your DSN::
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can't use the :: in these cases - it's short for .. code-block:: php, and it's just text below. Let's use:

.. code-block:: text

~~~~~~~~~~~~~~~~~~~~~~~~~~~

The options available in the DSN are documented on the ``Connection`` class
in the code repository.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@xabbuh xabbuh added the Waiting Code Merge Docs for features pending to be merged label May 18, 2018
Copy link
Contributor Author

@sroze sroze left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will update when the envelope one is merged :)

~~~~~~~~~~~~~~

If something wrong happens (i.e. an exception is thrown) while handling your message,
the default behaviour is that your message will be "NACK" and requeued.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not Acknowledge. Do you have any idea on how to phrase it differently? 🤷‍♂️


First, create your sender::

namespace App\MessageSender;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, why not 👍

the first failure, it will wait 10 seconds before trying it. After the 2nd failure,
it will wait 30 seconds. After the 3rd failure, it will wait a minute. If it still
fails, the message will be moved to a "dead queue" and you will have to manually
handle this message.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are to be removed as retry wasn't merged in.

@javiereguiluz
Copy link
Member

Anyone with experience in Messenger is willing to do the final push required to finish this pull request? Thanks!

@llaakkkk
Copy link

llaakkkk commented Apr 7, 2019

Thank you very much for your pull request!

As part of the Symfony EU funded hackathon (https://symfony.com/blog/the-symfony-and-api-platform-hackathon-is-coming), we were able to assemble most of the core team and big contributors in one place. Our goal is to finish as many open issues and PRs as possible.

Your commits will not be lost and you will therefore get credit for your work. All that will happen is that your commits will be moved to a new PR where all remaining concerns will be addressed.

Without your work this would not have been possible. So thank you once again!

@sroze
Copy link
Contributor Author

sroze commented Apr 7, 2019

Thank you @llaakkkk 🙌

@sroze sroze closed this Apr 7, 2019
@sroze sroze deleted the messenger-amqp-transport branch April 7, 2019 08:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Messenger Status: Needs Work Waiting Code Merge Docs for features pending to be merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants