Guest User

Untitled

a guest
Feb 20th, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. ##Server (separate running process)
  2.  
  3. require 'rubygems'
  4. require 'activerecord'
  5. require 'models/pco_outboundservice.rb'
  6.  
  7. ActiveRecord::Base.establish_connection(
  8. :adapter => 'oracle',
  9. :database => '10.0.1.22/xe',
  10. :username => 'mine',
  11. :password => 'mine')
  12.  
  13. class FetchCLI
  14. def get prefix
  15. service = PcoOutboundservice.find(:first, :conditions => ["PHONEPREFIX = ?", prefix])
  16. #service = PcoOutboundservice.find(:first)
  17. if service != nil
  18. return service.name
  19. else
  20. return "Nothing found"
  21. end
  22. end
  23. end
  24.  
  25. drb_server_object = FetchCLI.new
  26. DRb.start_service('druby://localhost:4567', drb_server_object)
  27. DRb.thread.join
  28.  
  29. ##Client - Will be Adhearsion
  30. require 'drb'
  31.  
  32. DRb.start_service
  33. drb_server = DRbObject.new(nil, 'druby://localhost:4567')
  34.  
  35. puts drb_server.get('313')
Add Comment
Please, Sign In to add comment