E-commerce under the hood

99d4c0ed3c8027ea1c37b53d6441d042?s=47 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

99d4c0ed3c8027ea1c37b53d6441d042?s=128

sullis

February 21, 2017
Tweet

Transcript

  1. 2.

    • software engineer • 20 years Java • 6 years

    at Gilt • back office systems @ Gilt About me
  2. 4.
  3. 12.

    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
  4. 14.

    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
  5. 16.

    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
  6. 27.

    “OPM is a Scala library for managing the value of

    an object over time as a timeline of changes” https://github.com/gilt/opm
  7. 34.

    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"
  8. 43.

    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
  9. 44.
  10. 45.