Module: Mikka
- Defined in:
- lib/mikka.rb,
lib/mikka/version.rb
Defined Under Namespace
Modules: ImplicitSender, Messages, Remote, RubyesqueActorCallbacks, SupervisionDsl
Classes: Actor, ProcActor
Constant Summary
collapse
- VERSION =
'1.1.1'
Class Method Summary
collapse
Class Method Details
.actor(&block) ⇒ Object
14
15
16
|
# File 'lib/mikka.rb', line 14
def self.actor(&block)
Akka::Actor::Actors.actor_of { ProcActor.new(&block) }
end
|
.actor_of(*args, &block) ⇒ Object
10
11
12
|
# File 'lib/mikka.rb', line 10
def self.actor_of(*args, &block)
Akka::Actor::Actors.actor_of(*args, &block)
end
|
.current_actor ⇒ Object
22
23
24
|
# File 'lib/mikka.rb', line 22
def self.current_actor
Thread.current[:mikka_current_actor]
end
|
.load_balancer(options = {}) ⇒ Object
168
169
170
171
172
173
174
175
176
177
178
179
180
181
|
# File 'lib/mikka.rb', line 168
def self.load_balancer(options={})
actors = options[:actors]
unless actors
type = options[:type]
count = options[:count]
raise ArgumentError, "Either :actors or :type and :count must be specified" unless type && count
actors = (0...count).map { actor_of(type) }
end
actors.each { |a| a.start }
actor_list = Arrays.as_list(actors.to_java)
actor_seq = Akka::Routing::CyclicIterator.new(actor_list)
actor_factory = proc { actor_seq }.to_function
Akka::Routing::Routing.load_balancer_actor(actor_factory)
end
|
.registry ⇒ Object
18
19
20
|
# File 'lib/mikka.rb', line 18
def self.registry
Akka::Actor::Actors.registry
end
|