2017-11-27 21 views
2

아파치 빔 파이프 라인이 성공적으로 데이터 흐름 템플릿으로 실행되고 있습니다. 그러나, 나는 DataflowPipelineOptions를 확장하는 옵션 클래스를 가지고있다. 이 클래스는 템플릿이 생성 될 때 pom이나 명령 행 인터페이스에서 인수를 얻었습니다. 속성 파일에서이 매개 변수를 직접로드 할 수 있도록 일부 클래스가 있는지 알고 싶습니다. 이렇게하면 환경에서 환경으로 전환하는 것이 더 쉬울 것이고 청소기가됩니다.Apache Beam Options에서 속성 파일

답변

2

나는 당신의 질문을 이해하지 못합니다. 기본 템플릿 매개 변수를 명령 줄 또는 pom.xml 파일이 아닌 리소스 파일에서 제공된 값에 바인딩하는 방법이 있는지 묻고있는 것 같습니다.

PipelineOptions으로 지정된 매개 변수에는 @Default.InstanceFactory이라는 주석을 달아 매개 변수의 기본값을 생성하는 사용자 제공 팩토리 방법을 지정할 수 있습니다. 이를 통해 DefaultValueFactory 구현 내부의 리소스 파일에서 기본값을 읽을 수 있습니다.

/** A {@link DefaultValueFactory} that returns the current system time. */ 
public static class DefaultToCurrentSystemTime implements DefaultValueFactory<Long> { 
    @Override 
    public Long create(PipelineOptions options) { 
    return System.currentTimeMillis(); 
    } 
} 

@Description("Minimum randomly assigned timestamp, in milliseconds-since-epoch") 
@Default.InstanceFactory(DefaultToCurrentSystemTime.class) 
Long getMinTimestampMillis(); 
void setMinTimestampMillis(Long value); 
: WindowedWordCountDefaultToCurrentSystemTime를 정의하는 방법을 예를 들어

는가 minTimestampMillis 매개 변수를 주석 참조