Building an E-Commerce Marketplace Middleware in Clojure

Building an E-Commerce Marketplace Middleware in Clojure

Have you ever wondered how we can build a real-world, production-ready, end-to-end application using the functional programming principles? Immutability, Pure Functions and all other functional programming things sound good on paper but How can we build something useful by applying it?

At Ajira, We recently built an e-commerce marketplace middleware in Clojure for a leading retail chain to sell their products on multiple e-commerce sites seamlessly. In this case study, we are going to build a minimal version of this project using which I will be sharing how we implemented it.

C6dbbb399f7658917f60bd1e2a2663ed?s=128

Tamizhvendan S

November 15, 2019
Tweet

Transcript

  1. 1.

    Lead Consultant www.ajira.tech Tamizhvendan S Passionate, Pragmatic and Polyglot Programmer

    https://www.demystifyfp.com tamizhvendan Building an E-Commerce Marketplace Middleware in Clojure
  2. 4.
  3. 13.

    OMS … IBMMQ Marketplace Middleware HTTP Back office Twelve Different

    Types Of Messages Ranging, Deranging, Pricing, Confirming Order, etc.,
  4. 14.

    OMS … IBMMQ Marketplace Middleware HTTP Back office Twelve Different

    Types Of Messages Ranging, Deranging, Pricing, Confirming Order, etc., Three Different Target Systems Tata-CliQ, Flipkart, Amazon
  5. 15.

    OMS … IBMMQ Marketplace Middleware HTTP Back office Twelve Different

    Types Of Messages Ranging, Deranging, Pricing, Confirming Order, etc., Three Different Target Systems Tata-CliQ, Flipkart, Amazon Four Different Data Representations OMS, Tata-CliQ, Flipkart, Amazon
  6. 16.

    OMS … IBMMQ Marketplace Middleware HTTP Back office Twelve Different

    Types Of Messages Ranging, Deranging, Pricing, Confirming Order, etc., Three Different Target Systems Tata-CliQ, Flipkart, Amazon Four Different Data Representations OMS, Tata-CliQ, Flipkart, Amazon Error Handling Invalid Message, Invalid Channel Configuration, Processing Failure, etc.,
  7. 19.

    Reading messages from IBMMQ and dispatching them to handler Parsing

    the message Processing the message Logging the events OMS … IBMMQ Marketplace Middleware HTTPS Back office Handling the message
  8. 20.

    Reading messages from IBMMQ and dispatching them to handler Parsing

    the message Polymorphic) Processing the message Polymorphic) Logging the events PostgreSQL, Slack) OMS … IBMMQ Marketplace Middleware HTTPS Back office Handling the message
  9. 21.

    Reading messages from IBMMQ and dispatching them to handler Parsing

    the message Polymorphic) Processing the message Polymorphic) Handling the message Logging the events PostgreSQL, Slack) Separate Application Boundaries
  10. 23.

    A Sample Ranging Message <EXTNChannelList> <EXTNChannelItemList> <EXTNChannelItem ChannelID="UA" EAN="EAN_1" ItemID="SKU1"

    RangeFlag="Y"AB <EXTNChannelItem ChannelID="UA" EAN="EAN_2" ItemID=“SKU2" RangeFlag="Y"AB AEEXTNChannelItemList> <EXTNChannelItemList> <EXTNChannelItem ChannelID="UB" EAN="EAN_3" ItemID="SKU3" RangeFlag="Y"AB AEEXTNChannelItemList> AEEXTNChannelList>
  11. 25.

    A Sample Pricing Message <EXTNChannelList> <EXTNChannelItemList ChannelID="UA"> <EXTNChannelItem ItemID="194521"> <VKP0PriceLine

    VKP0Price="999.1292"AB <OfferPriceLine OfferPrice="999"AB <ZMRPPriceLine ZMRPPrice="1000"AB AEEXTNChannelItem> <EXTNChannelItem ItemID="185027"> <VKP0PriceLine VKP0Price="650"AB <OfferPriceLine OfferPrice="650"AB <ZMRPPriceLine ZMRPPrice="700"AB AEEXTNChannelItem> AEEXTNChannelItemList> AEEXTNChannelList>
  12. 28.
  13. 29.
  14. 30.
  15. 31.
  16. 32.
  17. 33.
  18. 34.
  19. 35.
  20. 36.
  21. 37.

    Reading messages from IBMMQ and dispatching them to handler Parsing

    the message Polymorphic) Processing the message Polymorphic) Handling the message Logging the events PostgreSQL, Slack) Progress …
  22. 44.
  23. 45.
  24. 46.
  25. 47.
  26. 48.

    Reading messages from IBMMQ and dispatching them to handler Parsing

    the message Polymorphic) Processing the message (ranging) Handling the message Logging the events PostgreSQL, Slack) Progress … Getting the channel config Polymorphic) Updating the channel
  27. 52.

    Reading messages from IBMMQ and dispatching them to handler Parsing

    the message Polymorphic) Processing the message (ranging) Handling the message Logging the events PostgreSQL, Slack) Progress … Getting the channel config Polymorphic) Updating the channel
  28. 54.
  29. 55.
  30. 56.
  31. 57.
  32. 58.
  33. 59.
  34. 60.
  35. 61.
  36. 62.
  37. 70.
  38. 71.
  39. 73.

    Reading messages from IBMMQ and dispatching them to handler Parsing

    the message Polymorphic) Processing the message (ranging) Handling the message Logging the events PostgreSQL, Slack) Progress … Getting the channel config Polymorphic) Updating the channel
  40. 75.

    Reading messages from IBMMQ and dispatching them to handler Parsing

    the message Polymorphic) Processing the message (pricing) Handling the message Logging the events PostgreSQL, Slack) Pricing - Repeat Yourself Getting the channel config Polymorphic) Updating the channel
  41. 76.

    Reading messages from IBMMQ and dispatching them to handler Parsing

    the message Polymorphic) Processing the message Polymorphic) Handling the message Logging the events PostgreSQL, Slack) Progress …
  42. 78.

    Reading messages from IBMMQ and dispatching them to handler Parsing

    the message Polymorphic) Processing the message Polymorphic) Handling the message Logging the events PostgreSQL, Slack) Progress …
  43. 80.

    Integration Operation Segregation Principle (IOSP) A module should either contain

    business logic or integrate other modules but not both.
  44. 81.
  45. 82.

    Polymorphic) Polymorphic) Processing the message Getting the channel config Transforming

    the message Performing the action Reading messages from IBMMQ and dispatching them to handler Parsing the message Handling the message Polymorphic) Logging the event PostgreSQL, Slack) Progress … Getting the channel config
  46. 85.

    Reading messages from IBMMQ and dispatching them to handler Parsing

    the message Polymorphic) Processing the message Polymorphic) Handling the message Logging the events PostgreSQL, Slack) Progress …
  47. 88.

    https://www.youtube.com/watch?v=yTkzNHF6rMs … functional core is surrounded by a shell of

    imperative code: it manipulates stdin, stdout, the database, and the network, all based on values produced by the functional core.
  48. 89.

    https://www.youtube.com/watch?v=yTkzNHF6rMs … functional core is surrounded by a shell of

    imperative code: it manipulates stdin, stdout, the database, and the network, all based on values produced by the functional core.
  49. 92.
  50. 101.