Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagejava
themeEmacs
	protected void persistenceMessage(ActorSystem system,SpringExtension ext)  {
	    new TestKit(system) {{
	    	ActorRef probe = getRef();
	    	//메시지 목적대상 액터 생성
	    	final ActorRef myDestination = system.actorOf(ext.props("myDestination"),"myDes");	    	
	    	final ActorSelection myDes = system.actorSelection("/user/myDes");
	    	
	    	//재전송가능한 메시지 발송기 생성 ( 옵션은 목적대상 액터선택자 ) 
	        final ActorRef myPersistentActor = system.actorOf( ext.props("myPersistentActor",myDes ), "myPersistentActor"  );
	        
	        for(int i=0;i<10;i++) {
	        	myPersistentActor.tell( "hi " + i ,ActorRef.noSender() );	        	
	        }
	        
	        //장애 시나리오를 가정하고,메시지가 모두 처리되는 시간 25초로 가정
	        expectNoMessage(java.time.Duration.ofSeconds(25));	        
	    }};
	}


Expand
title테스트결과

의도적으로 드랍한 메시지가 결국 성공됨을 확인할수가 있습니다.

drop msg for test:86
msg ok :87
drop msg for test:88
msg ok :89
drop msg for test:90
msg ok :91
drop msg for test:92
msg ok :93
drop msg for test:94
msg ok :95
drop msg for test:86
msg ok :88
drop msg for test:90
msg ok :92
drop msg for test:94
msg ok :86
drop msg for test:90
msg ok :94
drop msg for test:90
msg ok :90

...