You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

이것은, 다양한 구독/발생 메시지 모델을 구현하기위해

Java의 TopicEventBus 참조하여, .net에서 직접 모듈을 작성해보았습니다. 

현재 해당 모듈이 추가되었을것으로 생각됩니다.


다양한 언어의 시청자가 존재하는 다국어 방송 메시지 모듈

//Create Act Act System for Testing
ActorSystem system = TopicEventBus.inItSystem("TestTopic"); //ActorSystem Init
 
//Create user
TopicEventBus.CreateActor("A");
TopicEventBus.CreateActor("B");
TopicEventBus.CreateActor("C");
 
//A user wants to receive News A in English
TopicEventBus.Subscribe("A", "newsA", "en").Wait();
 
//User B wants to receive news A in Korean
TopicEventBus.Subscribe("B", "newsA", "kr").Wait();
 
//Users of c want to receive News B in English
TopicEventBus.Subscribe("C", "newsB", "en").Wait();
 
 
//Server real-time messages (server sprays news regardless of user)
TopicEventBus.Publish("newsA", "Hi...here news A", "en");
TopicEventBus.Publish("newsA", "여기에 새로운 뉴스가 있습니다.", "kr");
TopicEventBus.Publish("newsB", "Hi...here news B", "en");

Result:
create actor name:A
create actor name:B
create actor name:C
Subscribe actor name:A to newsA
Subscribe actor name:B to newsA
A FirstSet LangCode en from newsA
B FirstSet LangCode kr from newsA
Subscribe actor name:C to newsB
C FirstSet LangCode en from newsB
Publish Topic:newsA msg:Hi...here news A
Publish Topic:newsA msg:여기에 새로운 뉴스가 있습니다.
A가 뉴스를 받음 Hi...here news A from newsA
Publish Topic:newsB msg:Hi...here news B
C가 뉴스를 받음 Hi...here news B from newsB
B가 뉴스를 받음 여기에 새로운 뉴스가 있습니다. from newsA



저장소위치:

http://git.webnori.com/projects/AKKA/repos/topiceventbus/browse


  • No labels