Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Mage Titans USA 2016 - Joshua Warren - Magento 2 Integrations


Published on

Magento has long been the core system connecting and integrating various business systems. With Magento 2, we have even more tools at our disposal for these integrations – APIs, webhooks & RabbitMQ are all available to us. In this talk, we’ll cover how to determine which integration method to use for your project and work through a sample ERP integration utilizing Magento 2 Enterprise.

Published in: Technology
  • Be the first to comment

Mage Titans USA 2016 - Joshua Warren - Magento 2 Integrations

  1. 1. @JoshuaSWarren #MageTitansUSA About Me • PHP-Based Ecommerce Developer Since 1999 • Magento Developer Since 2008; Magento 2 Developer Since 2014 • Magento Master • Founder & CEO of Creatuity Corp, Magento Enterprise Solution Partner
  2. 2. @JoshuaSWarren #MageTitansUSA Integrations
  3. 3. @JoshuaSWarren #MageTitansUSA Discussing complex, data- intensive integrations
  4. 4. @JoshuaSWarren #MageTitansUSA Let’s look at the new option in Magento 2
  5. 5. @JoshuaSWarren #MageTitansUSA What is it? How do we use it?
  6. 6. @JoshuaSWarren #MageTitansUSA Magento 1 Integration Options • SOAP API • REST API*
  7. 7. @JoshuaSWarren #MageTitansUSA Magento 2 Integration Options • SOAP API • REST API • Web Hooks* • RabbitMQ*
  8. 8. @JoshuaSWarren #MageTitansUSA RabbitMQ
  9. 9. @JoshuaSWarren #MageTitansUSA Messaging Queue
  10. 10. @JoshuaSWarren #MageTitansUSA Messages can be plaintext, process commands or any other type of information.
  11. 11. @JoshuaSWarren #MageTitansUSA Queue is a place where messages are held until a consumer connects and retrieves them.
  12. 12. @JoshuaSWarren #MageTitansUSA In other words…
  13. 13. RabbitMQ:These Go to 11
  14. 14. @JoshuaSWarren #MageTitansUSA RabbitMQ consistently sorts and delivers over one million messages per second
  15. 15. @JoshuaSWarren #MageTitansUSA Magento hands a message off to RabbitMQ to be handled asynchronously
  16. 16. @JoshuaSWarren #MageTitansUSA RabbitMQ can be clustered as you scale up
  17. 17. @JoshuaSWarren #MageTitansUSA RabbitMQ decouples your Magento code from your integrations using messages
  18. 18. @JoshuaSWarren #MageTitansUSA To harness the power of RabbitMQ…
  19. 19. @JoshuaSWarren #MageTitansUSA think different
  20. 20. @JoshuaSWarren #MageTitansUSA Bi-directional sync between an ERP/OMS and Magento
  21. 21. Old Way
  22. 22. @JoshuaSWarren #MageTitansUSA When an order is placed, an event is fired and an observer handles sending the order data to the ERP
  23. 23. New Way
  24. 24. @JoshuaSWarren #MageTitansUSA Fire a message to RabbitMQ, move on
  25. 25. @JoshuaSWarren #MageTitansUSA MagentoFrameworkMessageQueue PublisherInterface $publisher $publisher->publish('creatuity.sent.oms', $this- >orderInterface);
  26. 26. @JoshuaSWarren #MageTitansUSA Topics • ‘creatuity.sent.oms’ is the topic • RabbitMQ can be configured to use topics to route messages to specific queues • Wildcard routing is possible - i.e., ‘creatuity.*’ would match all topics that start with ‘creatuity.’ • Topics allow the consumers connected to RabbitMQ to easily grab only the messages they need to process
  27. 27. @JoshuaSWarren #MageTitansUSA Messages • Can be an object, can be a string - can be anything you’d like • Allows the application on either end of the integration to use their native format • Keep it simple
  28. 28. @JoshuaSWarren #MageTitansUSA Route responses to your Magento code via communication.xml
  29. 29. @JoshuaSWarren #MageTitansUSA <config xsi:noNamespaceSchemaLocation="urn:magento:framework:Communication/etc/communication.xsd"> <topic name="creatuity.sent.oms" request="MagentoSalesApiDataOrderInterface"> <handler name="creatuityoms.sent.oms.handler" type="CreatuityOmsModelOms" method="saveOmsNum" /> </topic> <topic name="creatuity.sent.magento" request="MagentoSalesApiDataOrderInterface" > <handler name="creatuityoms.sent.magento.handler" type="CreatuityOmsModelOms" method="saveOmsNum" /> </topic> </config>
  30. 30. @JoshuaSWarren #MageTitansUSA public function saveOmsNum(CreatuityOmsModelOms $oms) { $oms->setData('MagentoOrderNum', $oms->getOrderNum()); $oms->setData('OmsOrderNum', $oms->getOmsNum()); $oms->save(); }
  31. 31. @JoshuaSWarren #MageTitansUSA Advantages of RabbitMQ • RabbitMQ can route messages to specific queues for you • Decouples your code from the API on the other side of the integration • There is a RabbitMQ client for every major language • Magento developers write Magento code, ERP developers write ERP code
  32. 32. @JoshuaSWarren #MageTitansUSA Gotchas
  33. 33. 2.0 2.1 2.2
  34. 34. @JoshuaSWarren #MageTitansUSA Magento 2.0, 2.1 and 2.2 all contain major changes to message queues
  35. 35. @JoshuaSWarren #MageTitansUSA Magento Enterprise Edition Only
  36. 36. @JoshuaSWarren #MageTitansUSA One more service to support in your web stack
  37. 37. @JoshuaSWarren #MageTitansUSA Magento Cloud Edition is a good option to offset this
  38. 38. @JoshuaSWarren #MageTitansUSA Homework
  39. 39. @JoshuaSWarren #MageTitansUSA Go try RabbitMQ out
  40. 40. @JoshuaSWarren #MageTitansUSA The key to success with RabbitMQ & all of Magento 2…
  41. 41. @JoshuaSWarren #MageTitansUSA Stop trying to apply old patterns and techniques
  42. 42. @JoshuaSWarren #MageTitansUSA Keep up with the new features and architectural advances
  43. 43. @JoshuaSWarren #MageTitansUSA RabbitMQ enables us to quickly integrate third-party systems in a new way
  44. 44. @JoshuaSWarren #MageTitansUSA We still don’t know the upper bound of Magento 2’s scalability
  45. 45. @JoshuaSWarren #MageTitansUSA Go build something awesome!