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

E-commerce under the hood

sullis
February 21, 2017

E-commerce under the hood

Portland Java User Group
February 21, 2017
Portland Oregon
keywords: Java, Scala, Ruby, Postgres, MongoDB, DynamoDB, Gilt

sullis

February 21, 2017
Tweet

More Decks by sullis

Other Decks in Technology

Transcript

  1. • software engineer • 20 years Java • 6 years

    at Gilt • back office systems @ Gilt About me
  2. ORDERS orders_audit_trigger AFTER INSERT OR DELETE OR UPDATE ON orders

    FOR EACH ROW EXECUTE PROCEDURE orders_audit_function() ORDER_ITEMS order_items_audit_trigger AFTER INSERT OR DELETE OR UPDATE ON order_items FOR EACH ROW EXECUTE PROCEDURE order_items_audit_function() Triggers
  3. select id,status,submitted_at,shipped_at from orders where id = 85352432; -[ RECORD

    1 ]+--------------------------- id | 85352432 status | x submitted_at | 2017-02-13 20:57:25+00 shipped_at | 2017-02-15 05:30:16.376+00
  4. select order_id,change_type,changed_at, old_shipped_at,new_shipped_at from orders_audit_log where order_id = 85352432 and

    old_shipped_at is null and new_shipped_at is not null; -[ RECORD 1 ]--+------------------------------ order_id | 85352432 change_type | u changed_at | 2017-02-15 14:12:26.668751+00 old_shipped_at | new_shipped_at | 2017-02-15 05:30:16.376+00
  5. “OPM is a Scala library for managing the value of

    an object over time as a timeline of changes” https://github.com/gilt/opm
  6. https://martinfowler.com/eaaDev/EventSourcing.html “The key to Event Sourcing is that we guarantee

    that all changes to the domain objects are initiated by the event objects"
  7. def put(order: Order): Task[Try[Unit]] = { val checkoutGuid: CheckoutSessionGuid =

    order.sessionGuid eventSourceApi.save( LogicalKey(checkoutGuid.toString()), Some(ContentKey(Json.toJson(order)))). map(_ => Success(())). handle { case e: Exception => Failure(e) } } Gilt checkout service