title: Best way to handle events in ecommerce store
body: <p>I have the ecommerce store. </p>
  
  <p>I faced automatization problems as my business growing.</p>
  
  <p>My website is written in PHP on <strong>Kohana Framework</strong>.</p>
  
  <p><strong>I want to automize many processes, but do not know where to dig deeper.</strong></p>
  
  <p><strong>Example</strong>:</p>
  
  <p>When order is recieved I want to fire the event "order.recieved". This event knows that my system needs to fire subevents and other actions:</p>
  
  <ul>
  <li>to log inventrory changes asynchronously;</li>
  <li>send to the procurement module out-of-stock products and their quantity;</li>
  <li>to recreate sliced inventory table asynchronously;</li>
  <li>send real-time message to crm system that order is recieved;</li>
  <li>send sms to the client with message "We will call you soon";</li>
  <li>etc.</li>
  </ul>
  
  <p><strong>Solutions I have in my head:</strong></p>
  
  <p>1) I think the simplest way is to rewrite my application on Laravel framework with it's event dispatcher.</p>
  
  <p><em>Challenges</em>:</p>
  
  <ul>
  <li>I want use fifo (First In, First Out) for the inventory change;</li>
  <li>I need digging to the code to know how many events I have in my system, when they are used,</li>
  </ul>
  
  <p>2) Use AMQP Middleware like RabbitMQ.</p>
  
  <p><em>Challenges</em>:</p>
  
  <ul>
  <li>I need digging to the code to know where exactly message is sent;</li>
  <li>Maybe It can be solved with some event dispatcher, but ->; </li>
  <li>Again, I need digging to the code to know how many events I have in my system, when they are used</li>
  </ul>
  
  <p>Are php workers/consumers good to handle messages? Or I need to use python, nodejs?</p>
  
  <p><em>Challenges</em>:</p>
  
  <ul>
  <li>I need to have many php workers/consumers. I think PHP is not good to handle this.</li>
  </ul>
  
  <p>3) Use some webhooks management system. </p>
  
  <p>4) Study more and use some bpm engine. Only one thing I know right now I can benefit using business rule engine for complex discounts.</p>
  
  <p>What solution I need to take and get deeper with it?</p>