Class: BBMB::Util::App
- Inherits:
-
SBSM::App
- Object
- SBSM::App
- BBMB::Util::App
- Defined in:
- lib/bbmb/util/app.rb
Instance Attribute Summary collapse
-
#db_manager ⇒ Object
Returns the value of attribute db_manager.
-
#yus_server ⇒ Object
Returns the value of attribute yus_server.
Instance Method Summary collapse
-
#initialize ⇒ App
constructor
A new instance of App.
- #send_order(order, customer) ⇒ Object
- #start_service ⇒ Object
Constructor Details
Instance Attribute Details
#db_manager ⇒ Object
Returns the value of attribute db_manager.
29 30 31 |
# File 'lib/bbmb/util/app.rb', line 29 def db_manager @db_manager end |
#yus_server ⇒ Object
Returns the value of attribute yus_server.
29 30 31 |
# File 'lib/bbmb/util/app.rb', line 29 def yus_server @yus_server end |
Instance Method Details
#send_order(order, customer) ⇒ Object
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 |
# File 'lib/bbmb/util/app.rb', line 65 def send_order order, customer SBSM.logger.info "send_order #{order.order_id} and customer #{customer.customer_id}" begin Timeout.timeout(300) { BBMB::Util::TargetDir.send_order(order) } rescue StandardError => err err. << " (Email: #{customer.email} - Customer-Id: #{customer.customer_id})" BBMB::Util::Mail.notify_error(err) end begin Timeout.timeout(300) { BBMB::Util::Mail.send_order(order) } rescue StandardError => err err. << " (Email: #{customer.email} - Customer-Id: #{customer.customer_id})" BBMB::Util::Mail.notify_error(err) end begin Timeout.timeout(300) { BBMB::Util::Mail.send_confirmation(order) } rescue StandardError => err err. << " (Email: #{customer.email} - Customer-Id: #{customer.customer_id})" BBMB::Util::Mail.notify_error(err) end end |
#start_service ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/bbmb/util/app.rb', line 30 def start_service case BBMB.config.persistence when 'odba' DRb.install_id_conv ODBA::DRbIdConv.new BBMB.persistence = BBMB::Persistence::ODBA end BBMB.auth = DRb::DRbObject.new(nil, BBMB.config.auth_url) BBMB.server = BBMB::Util::Server.new(BBMB.persistence, self) BBMB.server.extend(DRbUndumped) BBMB.server = BBMB.server if(BBMB.config.update?) BBMB.server.run_updater end if(BBMB.config.invoice?) BBMB.server.run_invoicer end url = BBMB.config.server_url url.untaint DRb.start_service(url, BBMB.server) $SAFE = 1 $0 = BBMB.config.name SBSM.logger.info("started bbmb-server on #{url}") DRb.thread.join SBSM.logger.info('finished') { sprintf("starting bbmb-server on %s", url) } rescue Exception => error SBSM.logger.error('fatal') raise end |