Class: Iudex::BruteFuzzy::Service::Agent

Inherits:
Object
  • Object
show all
Includes:
Iudex::BruteFuzzy, Core, SimHash::BruteFuzzy, RJack::QpidClient
Defined in:
lib/iudex-brutefuzzy-service/agent.rb

Instance Method Summary collapse

Constructor Details

#initializeAgent

Returns a new instance of Agent.



33
34
35
# File 'lib/iudex-brutefuzzy-service/agent.rb', line 33

def initialize
  Hooker.apply( [ :iudex, :brutefuzzy_agent ], self )
end

Instance Method Details

#fuzzy_setObject



37
38
39
# File 'lib/iudex-brutefuzzy-service/agent.rb', line 37

def fuzzy_set
  FuzzyTree64.new( 500_000, 3, 16 )
end

#jms_connector(ctx) ⇒ Object



47
48
49
50
51
52
# File 'lib/iudex-brutefuzzy-service/agent.rb', line 47

def jms_connector( ctx )
  connector = JMSConnector.new( ctx )
  connector.max_connect_delay = java.lang.Integer::MAX_VALUE
  connector.do_close_connections = false
  connector
end

#jms_contextObject



41
42
43
44
45
# File 'lib/iudex-brutefuzzy-service/agent.rb', line 41

def jms_context
  ctx = QpidJMSContext.new
  Destinations.apply( ctx )
  ctx
end

#runObject



54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/iudex-brutefuzzy-service/agent.rb', line 54

def run
  ctx = jms_context
  Hooker.apply( [ :jms, :context ], ctx )

  connector = jms_connector( ctx )
  Hooker.apply( [ :jms, :connector ], connector )

  service = Service.new( fuzzy_set )
  Hooker.apply( [ :iudex, :brutefuzzy_service ], service )

  Hooker.log_not_applied # All hooks should be used by now

  connector.add_connect_listener( service )
  connector.connect_loop
end