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

2 TechDay - GURUPR - Microserviços

2 TechDay - GURUPR - Microserviços

Pontos positivos e negativos de usar microserviços, uma abordagem da experiência na pararfuzo.com

Elber Ribeiro

August 22, 2016
Tweet

Other Decks in Technology

Transcript

  1. PARAFUZO CORE Gem interna que contém toda a regra de

    negócio compartilhada entre api e admin
  2. PARAFUZO.COM Negociação de conteúdo via content-type Aplicativo Android Data Warehouse

    Indexador de busca application/json+app application/json+dw application/json+search
  3. PARAFUZO.COM class UserDecoratorApp < UserDecoratorBase extend Forwardable def_delegators :@model, :addresses,

    :needs_password?, :password, :state def links { "orders" => {href: url(:orders)}, "jobs" => {href: url(:jobs)}, } end def as_json(options={}) super({ addresses: addresses, state: state, has_password?: password.present?, needs_password?: needs_password?, credit_cards: credit_cards, _links: links }) end end
  4. PARAFUZO.COM class UserDecoratorDw < UserDecoratorBase include DecoratorHelper def_delegators :@model, :addresses,

    :credit_cards, :orders, :social_accounts def as_json(options = {}) super({ has_credit_card: has_credit_card, first_purchase_date: format_date(purchased_orders.first.try(:closed_at)), last_purchase_date: format_date(purchased_orders.last.try(:closed_at)), address: address_details(user_main_address), facebook_id: facebook_uid, created_at: format_date(created_at), updated_at: format_date(updated_at), total_revenue: total_revenue, total_charged_revenue: total_charged_revenue, utm_source: utms['source'], utm_campaign: utms['campaign'], utm_medium: utms['medium'], utm_content: utms['content'], kind: kind }) end end
  5. BARRAMENTO class Order include Mongoid::Document include Parafuzo::Core::Notify notify_with key: :number,

    includes: :state field :number , type: String field :state , type: String end
  6. BARRAMENTO module Chiron class JobsStrategy attr_reader :message, :builder def initialize(message)

    @message = message @builder = Builder.new PoseidonConsumer, ApolloPusher end def process resource = builder.resource message['uri'] return unless resource create(resource) if message['event'] == 'created' update(resource) if message['event'] == 'updated' end end end