2014-12-12 1 views
0

나는 sample의 지침을 따라 달렸다 : vertx에서 eventbus 메시징을 사용하는 방법은 무엇입니까?

vertx run eventbus_pointtopoint/receiver.rb -cluster 
vertx run eventbus_pointtopoint/sender.rb -cluster 

그럼 난 단지 가지고 :

➜ ruby vertx run eventbus_pointtopoint/receiver.rb -cluster 
Starting clustering... 
No cluster-host specified so using address 192.168.56.1 
Succeeded in deploying verticle 

➜ ruby vertx run eventbus_pointtopoint/sender.rb -cluster 
Starting clustering... 
No cluster-host specified so using address 192.168.56.1 
Succeeded in deploying verticle 

그러나 어떤 메시지가 수신되지. 내가 도대체 ​​뭘 잘못하고있는 겁니까?

답변

0

이벤트 버스 메시징의 작동 방식을보고 싶다면 두 코드를 하나의 파일로 옮기고 실행할 수 있습니다.

require "vertx" 
include Vertx 

EventBus.register_handler('ping-address') do |msg| 
    puts "Received message: #{msg.body}" 
    # Now reply to it 
    msg.reply('pong!') 
end 

Vertx::set_periodic(1000) do 
    EventBus.send('ping-address', 'ping') do |reply| 
    puts "Received reply: #{reply.body}" 
    end 
end 

당신은 당신이 당신의 vertx 설치의 conf 폴더에, 당신의 cluster.xml 구성 파일을 변경해야 할 수도 있습니다 클러스터링로 지정된 예제를 실행하려면 클러스터 실행합니다. 다음 사실

<tcp-ip enabled="true"> 

<tcp-ip enabled="false"> 

을 변경하고 확인 인터페이스 태그를 만들

<multicast enabled="false"> 

: 나는 false로, 첫 번째 변경

<multicast enabled="true"> 

을 두 줄을 변경했다 올바른 IP 주소를 가지고 있습니다. 위에서 지정한 명령을 실행해야합니다.

+0

두 개의 개별 앱을 실행하기 때문에 해결책이 아닙니다. – squixy

+0

두 번째 제안을 시도 했으므로 cluster.xml 파일을 편집 했습니까? 도움이 될만한 정보를 추가했습니다. –

+0

확실히 확인해 보겠습니다. – squixy

관련 문제