Order created

Have you looked deeper into the checkout and order API? In the order documentation you can find an Events section. These events are published when e.g. an order is created. With the PubSub service you can consume these events.

PubSub

The PubSub service enables clients on the YaaS platform to integrate using asynchronous message-based communication.” For more information you can read the PubSub documentation.

I will show you how you can use the PubSub nodes. Yesterday I updated the PubSub nodes. Therefore you should update the YaaS Node-RED modules (hint: npm install node-red-contrib-yaas).

Every time an order is created, PubSub sends a hybris.order.order-created event. Just drag & drop the PubSub read node into the flow and double click to configure it. The YaaS Credentials should be fine and also the Topic Owner Client and Event Type are already filled in with the correct values. If not, you need to update YaaS Node-RED 😉

With the PubSub read node all (new) orders, even those who are created by a shop, will return the order number. Adding a salesorders node will return all entries of this order:

PubSub and Salesorders nodes

Reading PubSub order created and the order items.

At this year’s Hybris Summit I used this to combine it with Node-RED and our Moto prototype. Every ordered item triggered a blinking on a Moto device which represented the product on top of it.

Moto at Hybris Summit 2016

Moto at Hybris Summit 2016.

 

PubSub read and Moto

Read order created and blink moto.

Publish events

With PubSub you can also publish your own events and listen to them. Therefore drag & drop the PubSub publish node to the flow and configure the Event Type. Now you can also add an inject node to send something to PubSub.

With a PubSub read node you can read this event when you use the same Event Type and leave the Topic Owner Client empty. Add a debug node to read and display this event.

PubSub publish and read

Sending and reading button.1 event with PubSub. 

Now you can find a product, add it to a shopping cart, check out and listen to an order created event. Do you need more? Of course, people love coupons 🙂

Further information:

Leave a Reply

Your email address will not be published. Required fields are marked *