Robust API communication with exponential backoff

Every API fails at random points of time and that’s unavoidable. Sadly, it’s not taken care correctly during integrating third party API’s. I see it very often. „Hey there! But I’m using try-catch and handle errors, sometimes even I log them to the file…” one might say. Well, so what? What happens when it fails and you miss data which needed to be fetched during the daily ETL process? Or your business partner misses information if you send data to their API and for some reason, it fails. What then? As long as you use cron and have output emailed to some mailbox, which is being monitored – you’ll notice. Maybe you use Sentry or any other application monitoring/error tracking software and you’ll spot some anomaly. But imagine having dozens of such jobs running on a daily basis – it’s easy to lose track.

I think you get my point now. API errors occur quite often. Most of them are due to temporary service unavailability, caused mainly by having too much traffic at the moment. The simple solution is to retry. In this post, I’ll show how to easily implement efficient retry mechanism.

Read more

RESTful Symfony2

Zapraszam do zapoznania się z moją prezentacją pt. RESTful Symfony2, którą można obejrzeć na xlabie

Read more

Dutch PHP Conference – review of the day 2

I had great pleasure to attend to Dutch PHP Conference day 2, as a replacement for collegue of mine. The conference met all my expectations – organisation was on very high level and talks were worth listening. Firstly I attended opening keynote by Helgi Þormar Þorbjörnsson, who spoke about importance of APIs in nowadays bussiness. He was very convincing and his arguments has made a lot of sense. Then I listened to Lorna Jane Mitchell and her OAuth talk. She perfectly describes what OAuth is, its benefits and shared a lot of examples with audience. Then we attended speach about Shared MySQL farm by Thijs Feryn – example of hosting MySQL in shared environment. After typical dutch lunch we went to Agility and Quality talk given by Sebastian Bergmann. Sebastians knowledge and experience is very impressive. The last regular session was one about Hadoop for PHP by David Zülke. It was the best one I attended. David spoke in very entertaining way and I guess that every attendee has some  Hadoop basics after that. But there were not only basics, but real life stats and live demo, which showed the power of Hadoop. In the end, Cal Evans refers in very charismatic way the idea of an open teams, the importance of flexibility and respect for the developers work.
I need to admit, that it was a very good conference and I willing to go there in next year. I hope it will be even better than this one 🙂

Read more