Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Building an E-Commerce Marketplace Middleware i...

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.

Tamizhvendan S

November 15, 2019
Tweet

More Decks by Tamizhvendan S

Other Decks in Programming

Transcript

  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. OMS … IBMMQ Marketplace Middleware HTTP Back office Twelve Different

    Types Of Messages Ranging, Deranging, Pricing, Confirming Order, etc.,
  3. 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
  4. 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
  5. 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.,
  6. 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
  7. 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
  8. 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
  9. 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>
  10. 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>
  11. 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 …
  12. 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
  13. 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
  14. 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
  15. 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
  16. 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 …
  17. 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 …
  18. Integration Operation Segregation Principle (IOSP) A module should either contain

    business logic or integrate other modules but not both.
  19. 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
  20. 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 …
  21. 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.
  22. 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.