magento 2 integrations: erps, apis, webhooks & rabbits! - magetitansusa 2016
TRANSCRIPT
![Page 1: Magento 2 Integrations: ERPs, APIs, Webhooks & Rabbits! - MageTitansUSA 2016](https://reader031.vdocuments.us/reader031/viewer/2022021922/587e007d1a28abe11a8b4881/html5/thumbnails/1.jpg)
![Page 2: Magento 2 Integrations: ERPs, APIs, Webhooks & Rabbits! - MageTitansUSA 2016](https://reader031.vdocuments.us/reader031/viewer/2022021922/587e007d1a28abe11a8b4881/html5/thumbnails/2.jpg)
![Page 3: Magento 2 Integrations: ERPs, APIs, Webhooks & Rabbits! - MageTitansUSA 2016](https://reader031.vdocuments.us/reader031/viewer/2022021922/587e007d1a28abe11a8b4881/html5/thumbnails/3.jpg)
@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
![Page 4: Magento 2 Integrations: ERPs, APIs, Webhooks & Rabbits! - MageTitansUSA 2016](https://reader031.vdocuments.us/reader031/viewer/2022021922/587e007d1a28abe11a8b4881/html5/thumbnails/4.jpg)
@JoshuaSWarren #MageTitansUSA
Integrations
![Page 5: Magento 2 Integrations: ERPs, APIs, Webhooks & Rabbits! - MageTitansUSA 2016](https://reader031.vdocuments.us/reader031/viewer/2022021922/587e007d1a28abe11a8b4881/html5/thumbnails/5.jpg)
@JoshuaSWarren #MageTitansUSA
Discussing complex, data-intensive integrations
![Page 6: Magento 2 Integrations: ERPs, APIs, Webhooks & Rabbits! - MageTitansUSA 2016](https://reader031.vdocuments.us/reader031/viewer/2022021922/587e007d1a28abe11a8b4881/html5/thumbnails/6.jpg)
@JoshuaSWarren #MageTitansUSA
Let’s look at the new option in Magento 2
![Page 7: Magento 2 Integrations: ERPs, APIs, Webhooks & Rabbits! - MageTitansUSA 2016](https://reader031.vdocuments.us/reader031/viewer/2022021922/587e007d1a28abe11a8b4881/html5/thumbnails/7.jpg)
@JoshuaSWarren #MageTitansUSA
What is it? How do we use it?
![Page 8: Magento 2 Integrations: ERPs, APIs, Webhooks & Rabbits! - MageTitansUSA 2016](https://reader031.vdocuments.us/reader031/viewer/2022021922/587e007d1a28abe11a8b4881/html5/thumbnails/8.jpg)
@JoshuaSWarren #MageTitansUSA
Magento 1 Integration Options
• SOAP API
• REST API*
![Page 9: Magento 2 Integrations: ERPs, APIs, Webhooks & Rabbits! - MageTitansUSA 2016](https://reader031.vdocuments.us/reader031/viewer/2022021922/587e007d1a28abe11a8b4881/html5/thumbnails/9.jpg)
@JoshuaSWarren #MageTitansUSA
Magento 2 Integration Options
• SOAP API
• REST API
• Web Hooks*
• RabbitMQ*
![Page 10: Magento 2 Integrations: ERPs, APIs, Webhooks & Rabbits! - MageTitansUSA 2016](https://reader031.vdocuments.us/reader031/viewer/2022021922/587e007d1a28abe11a8b4881/html5/thumbnails/10.jpg)
@JoshuaSWarren #MageTitansUSA
RabbitMQ
![Page 11: Magento 2 Integrations: ERPs, APIs, Webhooks & Rabbits! - MageTitansUSA 2016](https://reader031.vdocuments.us/reader031/viewer/2022021922/587e007d1a28abe11a8b4881/html5/thumbnails/11.jpg)
@JoshuaSWarren #MageTitansUSA
Messaging Queue
![Page 12: Magento 2 Integrations: ERPs, APIs, Webhooks & Rabbits! - MageTitansUSA 2016](https://reader031.vdocuments.us/reader031/viewer/2022021922/587e007d1a28abe11a8b4881/html5/thumbnails/12.jpg)
@JoshuaSWarren #MageTitansUSA
Messages can be plaintext, process commands or any other type of
information.
![Page 13: Magento 2 Integrations: ERPs, APIs, Webhooks & Rabbits! - MageTitansUSA 2016](https://reader031.vdocuments.us/reader031/viewer/2022021922/587e007d1a28abe11a8b4881/html5/thumbnails/13.jpg)
@JoshuaSWarren #MageTitansUSA
Queue is a place where messages are held until a consumer connects and
retrieves them.
![Page 14: Magento 2 Integrations: ERPs, APIs, Webhooks & Rabbits! - MageTitansUSA 2016](https://reader031.vdocuments.us/reader031/viewer/2022021922/587e007d1a28abe11a8b4881/html5/thumbnails/14.jpg)
@JoshuaSWarren #MageTitansUSA
In other words…
![Page 15: Magento 2 Integrations: ERPs, APIs, Webhooks & Rabbits! - MageTitansUSA 2016](https://reader031.vdocuments.us/reader031/viewer/2022021922/587e007d1a28abe11a8b4881/html5/thumbnails/15.jpg)
![Page 16: Magento 2 Integrations: ERPs, APIs, Webhooks & Rabbits! - MageTitansUSA 2016](https://reader031.vdocuments.us/reader031/viewer/2022021922/587e007d1a28abe11a8b4881/html5/thumbnails/16.jpg)
![Page 17: Magento 2 Integrations: ERPs, APIs, Webhooks & Rabbits! - MageTitansUSA 2016](https://reader031.vdocuments.us/reader031/viewer/2022021922/587e007d1a28abe11a8b4881/html5/thumbnails/17.jpg)
![Page 19: Magento 2 Integrations: ERPs, APIs, Webhooks & Rabbits! - MageTitansUSA 2016](https://reader031.vdocuments.us/reader031/viewer/2022021922/587e007d1a28abe11a8b4881/html5/thumbnails/19.jpg)
@JoshuaSWarren #MageTitansUSA
RabbitMQ consistently sorts and delivers over one million messages per second
http://bit.ly/2c303Wy
![Page 20: Magento 2 Integrations: ERPs, APIs, Webhooks & Rabbits! - MageTitansUSA 2016](https://reader031.vdocuments.us/reader031/viewer/2022021922/587e007d1a28abe11a8b4881/html5/thumbnails/20.jpg)
@JoshuaSWarren #MageTitansUSA
Magento hands a message off to RabbitMQ to be handled
asynchronously
![Page 21: Magento 2 Integrations: ERPs, APIs, Webhooks & Rabbits! - MageTitansUSA 2016](https://reader031.vdocuments.us/reader031/viewer/2022021922/587e007d1a28abe11a8b4881/html5/thumbnails/21.jpg)
@JoshuaSWarren #MageTitansUSA
RabbitMQ can be clustered as you scale up
![Page 22: Magento 2 Integrations: ERPs, APIs, Webhooks & Rabbits! - MageTitansUSA 2016](https://reader031.vdocuments.us/reader031/viewer/2022021922/587e007d1a28abe11a8b4881/html5/thumbnails/22.jpg)
@JoshuaSWarren #MageTitansUSA
RabbitMQ decouples your Magento code from your integrations using
messages
![Page 23: Magento 2 Integrations: ERPs, APIs, Webhooks & Rabbits! - MageTitansUSA 2016](https://reader031.vdocuments.us/reader031/viewer/2022021922/587e007d1a28abe11a8b4881/html5/thumbnails/23.jpg)
@JoshuaSWarren #MageTitansUSA
To harness the power of RabbitMQ…
![Page 24: Magento 2 Integrations: ERPs, APIs, Webhooks & Rabbits! - MageTitansUSA 2016](https://reader031.vdocuments.us/reader031/viewer/2022021922/587e007d1a28abe11a8b4881/html5/thumbnails/24.jpg)
@JoshuaSWarren #MageTitansUSA
think different
![Page 25: Magento 2 Integrations: ERPs, APIs, Webhooks & Rabbits! - MageTitansUSA 2016](https://reader031.vdocuments.us/reader031/viewer/2022021922/587e007d1a28abe11a8b4881/html5/thumbnails/25.jpg)
@JoshuaSWarren #MageTitansUSA
Bi-directional sync between an ERP/OMS and Magento
![Page 26: Magento 2 Integrations: ERPs, APIs, Webhooks & Rabbits! - MageTitansUSA 2016](https://reader031.vdocuments.us/reader031/viewer/2022021922/587e007d1a28abe11a8b4881/html5/thumbnails/26.jpg)
Old Way
![Page 27: Magento 2 Integrations: ERPs, APIs, Webhooks & Rabbits! - MageTitansUSA 2016](https://reader031.vdocuments.us/reader031/viewer/2022021922/587e007d1a28abe11a8b4881/html5/thumbnails/27.jpg)
@JoshuaSWarren #MageTitansUSA
When an order is placed, an event is fired and an observer handles sending
the order data to the ERP
![Page 28: Magento 2 Integrations: ERPs, APIs, Webhooks & Rabbits! - MageTitansUSA 2016](https://reader031.vdocuments.us/reader031/viewer/2022021922/587e007d1a28abe11a8b4881/html5/thumbnails/28.jpg)
New Way
![Page 29: Magento 2 Integrations: ERPs, APIs, Webhooks & Rabbits! - MageTitansUSA 2016](https://reader031.vdocuments.us/reader031/viewer/2022021922/587e007d1a28abe11a8b4881/html5/thumbnails/29.jpg)
@JoshuaSWarren #MageTitansUSA
Fire a message to RabbitMQ, move on
![Page 30: Magento 2 Integrations: ERPs, APIs, Webhooks & Rabbits! - MageTitansUSA 2016](https://reader031.vdocuments.us/reader031/viewer/2022021922/587e007d1a28abe11a8b4881/html5/thumbnails/30.jpg)
@JoshuaSWarren #MageTitansUSA
\Magento\Framework\MessageQueue\PublisherInterface $publisher
$publisher->publish('creatuity.sent.oms', $this->orderInterface);
![Page 31: Magento 2 Integrations: ERPs, APIs, Webhooks & Rabbits! - MageTitansUSA 2016](https://reader031.vdocuments.us/reader031/viewer/2022021922/587e007d1a28abe11a8b4881/html5/thumbnails/31.jpg)
@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
![Page 32: Magento 2 Integrations: ERPs, APIs, Webhooks & Rabbits! - MageTitansUSA 2016](https://reader031.vdocuments.us/reader031/viewer/2022021922/587e007d1a28abe11a8b4881/html5/thumbnails/32.jpg)
![Page 33: Magento 2 Integrations: ERPs, APIs, Webhooks & Rabbits! - MageTitansUSA 2016](https://reader031.vdocuments.us/reader031/viewer/2022021922/587e007d1a28abe11a8b4881/html5/thumbnails/33.jpg)
@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
![Page 34: Magento 2 Integrations: ERPs, APIs, Webhooks & Rabbits! - MageTitansUSA 2016](https://reader031.vdocuments.us/reader031/viewer/2022021922/587e007d1a28abe11a8b4881/html5/thumbnails/34.jpg)
@JoshuaSWarren #MageTitansUSA
Route responses to your Magento code via communication.xml
![Page 35: Magento 2 Integrations: ERPs, APIs, Webhooks & Rabbits! - MageTitansUSA 2016](https://reader031.vdocuments.us/reader031/viewer/2022021922/587e007d1a28abe11a8b4881/html5/thumbnails/35.jpg)
@JoshuaSWarren #MageTitansUSA
<config xsi:noNamespaceSchemaLocation="urn:magento:framework:Communication/etc/communication.xsd"> <topic name="creatuity.sent.oms" request="Magento\Sales\Api\Data\OrderInterface"> <handler name="creatuityoms.sent.oms.handler" type="Creatuity\Oms\Model\Oms" method="saveOmsNum" /> </topic> <topic name="creatuity.sent.magento" request="Magento\Sales\Api\Data\OrderInterface" > <handler name="creatuityoms.sent.magento.handler" type="Creatuity\Oms\Model\Oms" method="saveOmsNum" /> </topic> </config>
![Page 36: Magento 2 Integrations: ERPs, APIs, Webhooks & Rabbits! - MageTitansUSA 2016](https://reader031.vdocuments.us/reader031/viewer/2022021922/587e007d1a28abe11a8b4881/html5/thumbnails/36.jpg)
@JoshuaSWarren #MageTitansUSA
public function saveOmsNum(\Creatuity\Oms\Model\Oms $oms) { $oms->setData('MagentoOrderNum', $oms->getOrderNum()); $oms->setData('OmsOrderNum', $oms->getOmsNum()); $oms->save(); }
![Page 37: Magento 2 Integrations: ERPs, APIs, Webhooks & Rabbits! - MageTitansUSA 2016](https://reader031.vdocuments.us/reader031/viewer/2022021922/587e007d1a28abe11a8b4881/html5/thumbnails/37.jpg)
@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
![Page 38: Magento 2 Integrations: ERPs, APIs, Webhooks & Rabbits! - MageTitansUSA 2016](https://reader031.vdocuments.us/reader031/viewer/2022021922/587e007d1a28abe11a8b4881/html5/thumbnails/38.jpg)
@JoshuaSWarren #MageTitansUSA
Gotchas
![Page 39: Magento 2 Integrations: ERPs, APIs, Webhooks & Rabbits! - MageTitansUSA 2016](https://reader031.vdocuments.us/reader031/viewer/2022021922/587e007d1a28abe11a8b4881/html5/thumbnails/39.jpg)
2.0
2.1 2.2
![Page 40: Magento 2 Integrations: ERPs, APIs, Webhooks & Rabbits! - MageTitansUSA 2016](https://reader031.vdocuments.us/reader031/viewer/2022021922/587e007d1a28abe11a8b4881/html5/thumbnails/40.jpg)
@JoshuaSWarren #MageTitansUSA
Magento 2.0, 2.1 and 2.2 all contain major changes to message queues
![Page 41: Magento 2 Integrations: ERPs, APIs, Webhooks & Rabbits! - MageTitansUSA 2016](https://reader031.vdocuments.us/reader031/viewer/2022021922/587e007d1a28abe11a8b4881/html5/thumbnails/41.jpg)
![Page 42: Magento 2 Integrations: ERPs, APIs, Webhooks & Rabbits! - MageTitansUSA 2016](https://reader031.vdocuments.us/reader031/viewer/2022021922/587e007d1a28abe11a8b4881/html5/thumbnails/42.jpg)
@JoshuaSWarren #MageTitansUSA
Magento Enterprise Edition Only
![Page 43: Magento 2 Integrations: ERPs, APIs, Webhooks & Rabbits! - MageTitansUSA 2016](https://reader031.vdocuments.us/reader031/viewer/2022021922/587e007d1a28abe11a8b4881/html5/thumbnails/43.jpg)
![Page 44: Magento 2 Integrations: ERPs, APIs, Webhooks & Rabbits! - MageTitansUSA 2016](https://reader031.vdocuments.us/reader031/viewer/2022021922/587e007d1a28abe11a8b4881/html5/thumbnails/44.jpg)
@JoshuaSWarren #MageTitansUSA
One more service to support in your web stack
![Page 45: Magento 2 Integrations: ERPs, APIs, Webhooks & Rabbits! - MageTitansUSA 2016](https://reader031.vdocuments.us/reader031/viewer/2022021922/587e007d1a28abe11a8b4881/html5/thumbnails/45.jpg)
@JoshuaSWarren #MageTitansUSA
Magento Cloud Edition is a good option to offset this
![Page 46: Magento 2 Integrations: ERPs, APIs, Webhooks & Rabbits! - MageTitansUSA 2016](https://reader031.vdocuments.us/reader031/viewer/2022021922/587e007d1a28abe11a8b4881/html5/thumbnails/46.jpg)
@JoshuaSWarren #MageTitansUSA
Homework
![Page 47: Magento 2 Integrations: ERPs, APIs, Webhooks & Rabbits! - MageTitansUSA 2016](https://reader031.vdocuments.us/reader031/viewer/2022021922/587e007d1a28abe11a8b4881/html5/thumbnails/47.jpg)
@JoshuaSWarren #MageTitansUSA
Go try RabbitMQ out
![Page 48: Magento 2 Integrations: ERPs, APIs, Webhooks & Rabbits! - MageTitansUSA 2016](https://reader031.vdocuments.us/reader031/viewer/2022021922/587e007d1a28abe11a8b4881/html5/thumbnails/48.jpg)
@JoshuaSWarren #MageTitansUSA
The key to success with RabbitMQ & all of Magento 2…
![Page 49: Magento 2 Integrations: ERPs, APIs, Webhooks & Rabbits! - MageTitansUSA 2016](https://reader031.vdocuments.us/reader031/viewer/2022021922/587e007d1a28abe11a8b4881/html5/thumbnails/49.jpg)
@JoshuaSWarren #MageTitansUSA
Stop trying to apply old patterns and techniques
![Page 50: Magento 2 Integrations: ERPs, APIs, Webhooks & Rabbits! - MageTitansUSA 2016](https://reader031.vdocuments.us/reader031/viewer/2022021922/587e007d1a28abe11a8b4881/html5/thumbnails/50.jpg)
@JoshuaSWarren #MageTitansUSA
Keep up with the new features and architectural advances
![Page 51: Magento 2 Integrations: ERPs, APIs, Webhooks & Rabbits! - MageTitansUSA 2016](https://reader031.vdocuments.us/reader031/viewer/2022021922/587e007d1a28abe11a8b4881/html5/thumbnails/51.jpg)
@JoshuaSWarren #MageTitansUSA
RabbitMQ enables us to quickly integrate third-party systems in a new way
![Page 52: Magento 2 Integrations: ERPs, APIs, Webhooks & Rabbits! - MageTitansUSA 2016](https://reader031.vdocuments.us/reader031/viewer/2022021922/587e007d1a28abe11a8b4881/html5/thumbnails/52.jpg)
@JoshuaSWarren #MageTitansUSA
We still don’t know the upper bound of Magento 2’s scalability
![Page 53: Magento 2 Integrations: ERPs, APIs, Webhooks & Rabbits! - MageTitansUSA 2016](https://reader031.vdocuments.us/reader031/viewer/2022021922/587e007d1a28abe11a8b4881/html5/thumbnails/53.jpg)
@JoshuaSWarren #MageTitansUSA
Go build something awesome!