📜 ⬆️ ⬇️

And how did you help any community habrachelovek?

Imagine the situation ... You decided to screw some new technology to your project. Put everything you need, connect the library, and oops ... does not work. And here you are torturing, picking, but it still does not work and does not work. And after spending some time on this library, you decide to just drop the case, download a similar library from another team and try it.

Maybe it was not so. Maybe you are a very persistent and purposeful person and you decide to bring the matter to the end and help in the development of the product.

The story continues for those who do not care ...

Situation


We want to learn how to work with RabbitMQ through the Zend Framework using the STOMP protocol. So, we connect the necessary classes and immediately the question arises: how to work? Google - there is nothing. Well, okay, we climb into Wikipedia and find a link to the official website, where there is a description of the protocol with examples. By examples, we approximately understand in what order and what to call to make it work.
')
Written - the request is sent, but when a response is received, it hangs. Well, okay, dump requests - data is coming. We look in the HEX editor that comes, and then we look in the code, what is expected. We find an error in parsing the request in the Zend class.

Rule, run - wrong login. Again dump requests, but everything is correct and corresponds to the example. We try to emulate the protocol through telnet - the same errors. We try to remove the space after the colon in the headers, that is:
CONNECT
login:<username>
passcode:<passcode>


Earned! Aha We happily rub our hands and decide to put ActiveMQ and check the very first version on it. And, it works. All right, now we will tell the dunce from RabbitMQ how to write the code.

We write the letter, we receive the answer:

That is: your code hangs, because the Zend class expects a sequence of characters that is not defined by the specification, and we are not required to send them. And trailing spaces in the headers can be useful information, so we do not prune them. And, in general, we are writing a server compliant with specification 1.1, and your Zend only supports 1.0.

But let me ask, and where on the official website is it written about protocol 1.1?
Answer: And this is an old site, here's a link to a new one. And also here are two patches that tweak RabbitMQ for Zend’s bugs.

We were still a little different to clarify some details, and this is what we did at the exit.

Results


Afterword


There is nothing supernatural in this whole story. I just wanted to show that everyone can help develop community products. It is available and works. Perhaps you can give a more epic example.
So let us share similar stories with each other on Friday.

Source: https://habr.com/ru/post/127104/


All Articles