Class: GameMachine::MessageQueue
Constant Summary
Constants inherited
from Actor::Base
Actor::Base::ON_RECEIVE_HOOKS
Instance Method Summary
collapse
Methods inherited from Actor::Base
aspect, aspects, find, find_by_address, find_distributed, find_distributed_local, find_remote, hashring, local_path, model_filter, #onReceive, player_controller, #receive_message, #schedule_message, #sender, set_player_controller
Instance Method Details
#on_receive(message) ⇒ Object
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
# File 'lib/game_machine/message_queue.rb', line 10
def on_receive(message)
unless @mediator
GameMachine.logger.info "Cluster mediator not found, message queue disabled!"
unhandled(message)
return
end
if message.is_a?(MessageLib::Publish)
publish(message)
elsif message.is_a?(MessageLib::Subscribe)
subscribe(message)
elsif message.is_a?(MessageLib::Unsubscribe)
unsubscribe(message)
elsif message.is_a?(JavaLib::DistributedPubSubMediator::SubscribeAck)
GameMachine.logger.debug "Subscribed"
else
unhandled(message)
end
end
|
#preStart ⇒ Object
4
5
6
7
8
|
# File 'lib/game_machine/message_queue.rb', line 4
def preStart
if getContext.system.name == 'cluster'
@mediator = JavaLib::DistributedPubSubExtension.get(get_context.system).mediator
end
end
|