본문으로 바로가기 본문 바로가기
WIKI 기술 지식 베이스

Azure Storage Data Lake Service

원문 보기 위키 갱신

Azure Storage Data Lake Service (camel-azure-storage-datalake)

Azure Storage Data Lake Service 컴포넌트는 Azure Storage Data Lake Service에 파일을 저장하고 꺼내 쓸 수 있게 해 주는 컴포넌트예요. Azure APIs v12를 밑바탕으로 동작하며, producer와 consumer를 모두 지원합니다. 파일시스템·디렉터리·파일 레벨의 다양한 operation과 shared key·클라이언트 시크릿·SAS 같은 여러 인증 방식을 옵션으로 제공해요.

출처: 문서

본문

Camel 3.8부터 지원

producer와 consumer 모두 지원

Azure Storage Data Lake 컴포넌트는 Azure APIs v12를 이용해서 Azure Storage Data Lake Service에 파일을 저장하고 가져오는 데 쓰여요.

필수 요건 (Prerequisites)

유효한 Azure 계정에 Azure 스토리지가 설정되어 있어야 해요. 자세한 내용은 Azure 문서 포털에서 확인할 수 있어요.

Maven 사용자라면 이 컴포넌트를 쓰려고 pom.xml에 다음 의존성을 추가해야 해요.

<dependency>
    <groupId>org.apache.camel</groupId>
    <artifactId>camel-azure-storage-datalake</artifactId>
    <version>x.x.x</version>
    <!-- use the same version as your camel core version -->
</dependency>

URI 형식 (Uri Format)

azure-storage-datalake:accountName[/fileSystemName][?options]

consumer의 경우 accountName과 fileSystemName 둘 다 필수예요. producer의 경우에는 요청하는 operation에 따라 달라져요.

URI에는 다음 형식으로 쿼리 옵션을 붙일 수 있어요: ?option1=value&option2=value&…​

옵션 설정 (Configuring Options)

Camel 컴포넌트는 서로 다른 두 단계로 설정해요:

  • 컴포넌트(component) 레벨

  • 엔드포인트(endpoint) 레벨

컴포넌트 옵션 설정 (Configuring Component Options)

컴포넌트 레벨에서는 일반적이고 공유되는 설정을 지정하고, 이 설정은 엔드포인트들이 물려받아요. 가장 상위의 설정 단계예요.

예컨대 컴포넌트에는 보안 설정, 인증용 자격 증명, 네트워크 연결 URL 같은 것들이 들어갈 수 있어요.

컴포넌트에 따라 옵션이 몇 개뿐인 경우도 있고 많은 경우도 있어요. 컴포넌트는 보통 널리 쓰이는 기본값을 미리 갖추고 있어서, 컴포넌트에 설정할 옵션이 몇 개뿐이거나 아예 없을 때도 많아요.

컴포넌트를 설정하는 방법은 다음과 같아요:

  • Component DSL 사용.

  • 설정 파일에서 설정(application.properties, *.yaml 파일 등).

  • Java 코드에서 직접 설정.

엔드포인트 옵션 설정 (Configuring Endpoint Options)

엔드포인트는 옵션이 많아서 설정에 시간을 더 쓰게 돼요. 이 옵션들로 엔드포인트가 어떻게 동작할지 원하는 대로 조정할 수 있어요. 옵션은 엔드포인트를 consumer(from)로 쓰는지, producer(to)로 쓰는지, 둘 다 쓰는지에 따라 분류되기도 해요.

엔드포인트 설정은 대개 엔드포인트 URI에 _path_와 query 파라미터로 직접 하는 경우가 많아요. Java에서 엔드포인트와 데이터 포맷을 _타입 세이프_하게 설정하는 방법으로 Endpoint DSL과 DataFormat DSL을 쓸 수도 있어요.

옵션을 설정할 때 좋은 습관은 프로퍼티 플레이스홀더를 쓰는 거예요.

플레이스홀더를 쓰면 이런 점이 좋아요:

  • 하드코딩된 URL, 포트 번호, 민감한 정보 등의 설정 사용을 막아 줘요.

  • 설정을 코드 밖으로 분리할 수 있어요.

  • 코드가 더 유연해지고 재사용하기 좋아져요.

다음 두 섹션에서 모든 옵션을 나열해요. 먼저 컴포넌트 옵션, 그다음 엔드포인트 순서예요.

컴포넌트 옵션 (Component Options)

Azure Storage Data Lake Service 컴포넌트가 지원하는 옵션은 아래와 같아요.

Name Description Default Type
clientId (common) Azure 계정의 클라이언트 ID예요. String
close (common) 파일 변경 이벤트가 발생했을 때 완료(true)를 뜻하는지, 수정(false)을 뜻하는지 여부예요. false Boolean
closeStreamAfterRead (common) 읽은 후에 스트림을 닫을지 확인하는 옵션이에요. false Boolean
configuration (common) 데이터 레이크 설정 객체예요. DataLakeConfiguration
credentialType (common)
채택할 자격 증명(credential) 전략을 결정해요.

Enum values:

  • CLIENT_SECRET

  • SHARED_KEY_CREDENTIAL

  • AZURE_IDENTITY

  • AZURE_SAS

  • SERVICE_CLIENT_INSTANCE

| CLIENT_SECRET | CredentialType | | dataCount (common) | 다운로드할 바이트 수를 지정해요. | | Long | | directoryName (common) | 컴포넌트에서 다룰 파일의 디렉터리예요. | | String | | downloadLinkExpiration (common) | 다운로드 링크의 만료 시간이에요. | | Long | | expression (common) | queryInputStream에 쓰는 표현식이에요. | | String | | fileDir (common) | 로컬 시스템에서 파일 작업을 수행할 디렉터리예요. | | String | | fileName (common) | 컴포넌트에서 다룰 파일의 이름이에요. | | String | | fileOffset (common) | operation별로 사용할 파일 내 오프셋 위치예요. | | Long | | maxResults (common) | 한 번에 보여 줄 결과의 최대 개수예요. | | Integer | | maxRetryRequests (common) | 하나의 요청에 대한 재시도 횟수예요. | | int | | openOptions (common) | 파일을 만들 때 쓸 open options를 설정해요. | | Set | | path (common) | operation을 수행할 Azure Data Lake 내 경로예요. | | String | | permission (common) | 파일의 permission 문자열이에요. | | String | | position (common) | 이 파라미터를 쓰면 데이터를 병렬로 업로드하면서 파일에 덧붙이는(appending) 순서를 제어할 수 있어요. | | Long | | recursive (common) | 모든 경로를 재귀적으로 포함할지 여부예요. | false | Boolean | | regex (common) | 파일 이름을 매칭할 정규 표현식이에요. | | String | | retainUncommitedData (common) | operation 이후에도 커밋되지 않은 데이터를 유지할지 여부예요. | false | Boolean | | serviceClient (common) | Autowired Azure Storage Data Lake용 데이터 레이크 서비스 클라이언트예요. | | DataLakeServiceClient | | sharedKeyCredential (common) | Autowired Azure Data Lake Gen2용 shared key 자격 증명이에요. | | StorageSharedKeyCredential | | tenantId (common) | Azure 계정의 테넌트 ID예요. | | String | | timeout (common) | operation의 타임아웃이에요. | | Duration | | umask (common) | 파일의 umask permission이에요. | | String | | userPrincipalNameReturned (common) | UPN(user principal name)을 사용할지 여부예요. | false | Boolean | | bridgeErrorHandler (consumer) | consumer를 Camel 라우팅 에러 핸들러(routing Error Handler)에 연결(bridge)할 수 있게 해 줘요. 그러면 Camel consumer가 들어오는 메시지를 집어 올리는 동안 등에서 발생한 예외가(가능한 경우) 메시지로 처리되어 라우팅 에러 핸들러에서 다뤄져요. 중요: 이건 서드파티 컴포넌트가 예외가 던져졌을 때 Camel에 알려 줄 수 있을 때만 가능해요. 일부 컴포넌트는 내부에서만 예외를 처리하기 때문에 bridgeErrorHandler를 쓸 수 없어요. 다른 상황에서는 이후 릴리스에서 서드파티 컴포넌트에 연결(hook)해서 이를 가능하게끔 Camel 컴포넌트를 개선할 수도 있어요. 기본으로 consumer는 org.apache.camel.spi.ExceptionHandler를 써서 예외를 다루고, 예외는 WARN 또는 ERROR 레벨로 로그가 남고 무시돼요. | false | boolean | | lazyStartProducer (producer) | producer를 지연 시작(lazy, 첫 메시지 시점)할지 여부예요. 지연 시작을 쓰면 producer가 시작 중 실패해서 라우트 시작이 실패하는 상황에서도 CamelContext와 라우트가 시작될 수 있어요. 시작을 지연하면 시작 실패를 메시지를 라우팅하는 동안 Camel의 라우팅 에러 핸들러로 처리할 수 있죠. 단, 첫 메시지가 처리될 때 producer를 만들고 시작하는 데 시간이 조금 걸려서 전체 처리 시간이 길어질 수 있다는 점은 유의하세요. | false | boolean | | operation (producer) |

수행할 operation이에요.

Enum values:

  • listFileSystem

  • createFileSystem

  • deleteFileSystem

  • listPaths

  • getFile

  • downloadToFile

  • downloadLink

  • deleteFile

  • appendToFile

  • flushToFile

  • uploadFromFile

  • upload

  • openQueryInputStream

  • createFile

  • deleteDirectory

| listFileSystem | DataLakeOperationsDefinition | | autowiredEnabled (advanced) | 오토와이어링(autowiring)을 켤지 여부예요. 오토와이어링 대상 옵션(옵션이 autowired로 표시돼 있어야 함)을 레지스트리에서 찾아 일치하는 타입의 인스턴스가 하나뿐이면 그 인스턴스가 컴포넌트에 설정돼요. JDBC 데이터소스, JMS 커넥션 팩토리, AWS 클라이언트 등을 자동 구성할 때 쓸 수 있어요. | true | boolean | | healthCheckConsumerEnabled (health) | 이 컴포넌트의 consumer 기반 헬스 체크를 모두 켜거나 끌 때 사용해요. | true | boolean | | healthCheckProducerEnabled (health) | 이 컴포넌트의 producer 기반 헬스 체크를 모두 켜거나 끌 때 사용해요. 참고: Camel은 기본으로 producer 기반 헬스 체크를 모두 꺼 두었어요. camel.health.producersEnabled=true로 설정하면 producer 체크를 전역으로 켤 수 있어요. | true | boolean | | accountKey (security) | 인증용 계정 키(account key)예요. | | String | | clientSecret (security) | Azure 계정의 클라이언트 시크릿이에요. | | String | | clientSecretCredential (security) | Autowired 인증용 클라이언트 시크릿 자격 증명이에요. | | ClientSecretCredential | | sasCredential (security) | Autowired SAS 토큰 자격 증명이에요. | | AzureSasCredential | | sasSignature (security) | SAS 토큰 시그니처예요. | | String |

엔드포인트 옵션 (Endpoint Options)

Azure Storage Data Lake Service 엔드포인트는 다음 URI 문법으로 설정해요:

azure-storage-datalake:accountName/fileSystemName

다음 path 및 query 파라미터를 지원해요:

Path 파라미터 (Path Parameters)

Name Description Default Type
accountName (common) Azure 계정의 이름이에요. String
fileSystemName (common) 사용할 파일시스템의 이름이에요. String

Query 파라미터 (Query Parameters)

Name Description Default Type
clientId (common) Azure 계정의 클라이언트 ID예요. String
close (common) 파일 변경 이벤트가 발생했을 때 완료(true)를 뜻하는지, 수정(false)을 뜻하는지 여부예요. false Boolean
closeStreamAfterRead (common) 읽은 후에 스트림을 닫을지 확인하는 옵션이에요. false Boolean
credentialType (common)
채택할 자격 증명(credential) 전략을 결정해요.

Enum values:

  • CLIENT_SECRET

  • SHARED_KEY_CREDENTIAL

  • AZURE_IDENTITY

  • AZURE_SAS

  • SERVICE_CLIENT_INSTANCE

| CLIENT_SECRET | CredentialType | | dataCount (common) | 다운로드할 바이트 수를 지정해요. | | Long | | dataLakeServiceClient (common) | 데이터 레이크의 서비스 클라이언트예요. | | DataLakeServiceClient | | directoryName (common) | 컴포넌트에서 다룰 파일의 디렉터리예요. | | String | | downloadLinkExpiration (common) | 다운로드 링크의 만료 시간이에요. | | Long | | expression (common) | queryInputStream에 쓰는 표현식이에요. | | String | | fileDir (common) | 로컬 시스템에서 파일 작업을 수행할 디렉터리예요. | | String | | fileName (common) | 컴포넌트에서 다룰 파일의 이름이에요. | | String | | fileOffset (common) | operation별로 사용할 파일 내 오프셋 위치예요. | | Long | | maxResults (common) | 한 번에 보여 줄 결과의 최대 개수예요. | | Integer | | maxRetryRequests (common) | 하나의 요청에 대한 재시도 횟수예요. | | int | | openOptions (common) | 파일을 만들 때 쓸 open options를 설정해요. | | Set | | path (common) | operation을 수행할 Azure Data Lake 내 경로예요. | | String | | permission (common) | 파일의 permission 문자열이에요. | | String | | position (common) | 이 파라미터를 쓰면 데이터를 병렬로 업로드하면서 파일에 덧붙이는(appending) 순서를 제어할 수 있어요. | | Long | | recursive (common) | 모든 경로를 재귀적으로 포함할지 여부예요. | false | Boolean | | regex (common) | 파일 이름을 매칭할 정규 표현식이에요. | | String | | retainUncommitedData (common) | operation 이후에도 커밋되지 않은 데이터를 유지할지 여부예요. | false | Boolean | | serviceClient (common) | Autowired Azure Storage Data Lake용 데이터 레이크 서비스 클라이언트예요. | | DataLakeServiceClient | | sharedKeyCredential (common) | Autowired Azure Data Lake Gen2용 shared key 자격 증명이에요. | | StorageSharedKeyCredential | | tenantId (common) | Azure 계정의 테넌트 ID예요. | | String | | timeout (common) | operation의 타임아웃이에요. | | Duration | | umask (common) | 파일의 umask permission이에요. | | String | | userPrincipalNameReturned (common) | UPN(user principal name)을 사용할지 여부예요. | false | Boolean | | sendEmptyMessageWhenIdle (consumer) | 폴링 consumer가 파일을 아무것도 가져오지 못했을 때, 이 옵션을 켜면 대신 빈 메시지(본문 없음)를 보내요. | false | boolean | | bridgeErrorHandler (consumer (advanced)) | consumer를 Camel 라우팅 에러 핸들러(routing Error Handler)에 연결(bridge)할 수 있게 해 줘요. 그러면 Camel consumer가 들어오는 메시지를 집어 올리는 동안 등에서 발생한 예외가(가능한 경우) 메시지로 처리되어 라우팅 에러 핸들러에서 다뤄져요. 중요: 이건 서드파티 컴포넌트가 예외가 던져졌을 때 Camel에 알려 줄 수 있을 때만 가능해요. 일부 컴포넌트는 내부에서만 예외를 처리하기 때문에 bridgeErrorHandler를 쓸 수 없어요. 다른 상황에서는 이후 릴리스에서 서드파티 컴포넌트에 연결(hook)해서 이를 가능하게끔 Camel 컴포넌트를 개선할 수도 있어요. 기본으로 consumer는 org.apache.camel.spi.ExceptionHandler를 써서 예외를 다루고, 예외는 WARN 또는 ERROR 레벨로 로그가 남고 무시돼요. | false | boolean | | exceptionHandler (consumer (advanced)) | consumer가 커스텀 ExceptionHandler를 쓰게 할 수 있어요. bridgeErrorHandler 옵션이 켜져 있으면 이 옵션은 사용되지 않는다는 점에 주의하세요. 기본으로 consumer는 예외를 처리하는데, WARN 또는 ERROR 레벨로 로그가 남고 무시돼요. | | ExceptionHandler | | exchangePattern (consumer (advanced)) |

consumer가 교환(exchange)을 만들 때 교환 패턴을 설정해요.

Enum values:

  • InOnly

  • InOut

| | ExchangePattern | | pollStrategy (consumer (advanced)) | 플러그인으로 끼울 수 있는 org.apache.camel.PollingConsumerPollingStrategy예요. 커스텀 구현을 제공해서, Exchange가 만들어져 Camel에서 라우팅되기 전에 폴링 operation 중에 보통 발생하는 에러 처리를 직접 제어할 수 있어요. | | PollingConsumerPollStrategy | | operation (producer) |

수행할 operation이에요.

Enum values:

  • listFileSystem

  • createFileSystem

  • deleteFileSystem

  • listPaths

  • getFile

  • downloadToFile

  • downloadLink

  • deleteFile

  • appendToFile

  • flushToFile

  • uploadFromFile

  • upload

  • openQueryInputStream

  • createFile

  • deleteDirectory

| listFileSystem | DataLakeOperationsDefinition | | lazyStartProducer (producer (advanced)) | producer를 지연 시작(lazy, 첫 메시지 시점)할지 여부예요. 지연 시작을 쓰면 producer가 시작 중 실패해서 라우트 시작이 실패하는 상황에서도 CamelContext와 라우트가 시작될 수 있어요. 시작을 지연하면 시작 실패를 메시지를 라우팅하는 동안 Camel의 라우팅 에러 핸들러로 처리할 수 있죠. 단, 첫 메시지가 처리될 때 producer를 만들고 시작하는 데 시간이 조금 걸려서 전체 처리 시간이 길어질 수 있다는 점은 유의하세요. | false | boolean | | backoffErrorThreshold (scheduler) | backoffMultipler가 작동하기 전에 연속으로 발생해야 하는 에러 폴링(오류로 실패한 폴링) 횟수예요. | | int | | backoffIdleThreshold (scheduler) | backoffMultipler가 작동하기 전에 연속으로 발생해야 하는 유휴(idle) 폴링 횟수예요. | | int | | backoffMultiplier (scheduler) | 연속으로 유휴/에러 폴링이 여러 번 이어졌을 때 예약 폴링 consumer가 백오프하도록 해요. multiplier 값은 다음 실제 시도가 다시 일어나기 전까지 건너뛸 폴링 횟수예요. 이 옵션을 쓸 때는 backoffIdleThreshold 및/또는 backoffErrorThreshold도 함께 설정해야 해요. | | int | | delay (scheduler) | 다음 폴링 전까지 대기하는 밀리초예요. | 500 | long | | greedy (scheduler) | greedy를 켜면 이전 실행에서 메시지를 1개 이상 가져왔을 때 ScheduledPollConsumer가 바로 다시 실행돼요. | false | boolean | | initialDelay (scheduler) | 첫 폴링이 시작되기 전까지 대기하는 밀리초예요. | 1000 | long | | repeatCount (scheduler) | 실행(fire) 횟수의 최대 한도를 지정해요. 1로 설정하면 스케줄러가 한 번만 실행되고, 5로 설정하면 다섯 번만 실행돼요. 0이나 음수는 계속 실행한다는 뜻이에요. | 0 | long | | runLoggingLevel (scheduler) |

consumer는 폴링할 때 시작/완료 로그 한 줄을 남겨요. 이 옵션으로 그 로그 레벨을 설정할 수 있어요.

Enum values:

  • TRACE

  • DEBUG

  • INFO

  • WARN

  • ERROR

  • OFF

| TRACE | LoggingLevel | | scheduledExecutorService (scheduler) | consumer가 쓸 커스텀/공유 스레드 풀을 설정할 수 있어요. 기본으로 각 consumer는 자기만의 단일 스레드 스레드 풀을 가져요. | | ScheduledExecutorService | | scheduler (scheduler) | camel-spring 또는 camel-quartz 컴포넌트의 cron 스케줄러를 쓰게 해요. 내장 스케줄러를 쓰려면 spring 또는 quartz 값을 지정해요. | none | Object | | schedulerProperties (scheduler) | 커스텀 스케줄러나 Quartz, Spring 기반 스케줄러를 쓸 때 추가 프로퍼티를 설정해요. 접두어가 scheduler인 다중 값 옵션이에요. | | Map | | startScheduler (scheduler) | 스케줄러를 자동으로 시작할지 여부예요. | true | boolean | | timeUnit (scheduler) |

initialDelay와 delay 옵션의 시간 단위예요.

Enum values:

  • NANOSECONDS

  • MICROSECONDS

  • MILLISECONDS

  • SECONDS

  • MINUTES

  • HOURS

  • DAYS

| MILLISECONDS | TimeUnit | | useFixedDelay (scheduler) | 고정 지연(fixed delay)을 쓸지 고정 비율(fixed rate)을 쓸지 제어해요. 자세한 내용은 JDK의 ScheduledExecutorService를 참고하세요. | true | boolean | | accountKey (security) | 인증용 계정 키(account key)예요. | | String | | clientSecret (security) | Azure 계정의 클라이언트 시크릿이에요. | | String | | clientSecretCredential (security) | Autowired 인증용 클라이언트 시크릿 자격 증명이에요. | | ClientSecretCredential | | sasCredential (security) | Autowired SAS 토큰 자격 증명이에요. | | AzureSasCredential | | sasSignature (security) | SAS 토큰 시그니처예요. | | String |

메시지 헤더 (Message Headers)

Azure Storage Data Lake Service 컴포넌트는 아래 나열된 메시지 헤더(들)를 지원해요:

Name Description Default Type
CamelAzureStorageDataLakeListFileSystemsOptions (producer) Constant: LIST_FILESYSTEMS_OPTIONS DataLakeServiceAsyncClient 객체에서 listFileSystemsSegment 호출의 동작을 설정하는 데 쓸 수 있는 옵션을 정의해요. null을 넘길 수도 있어요. ListFileSystemsOptions
CamelAzureStorageDataLakeTimeout (producer) Constant: TIMEOUT 이 값을 넘기면 RuntimeException이 발생하는 선택적 타임아웃 값이에요. Duration
CamelAzureStorageDataLakeOperation (producer) Constant: DATALAKE_OPERATION
실행할 producer operation을 지정해요. 허용되는 operation들은 아래와 같아요.

Enum values:

  • listFileSystem

  • createFileSystem

  • deleteFileSystem

  • listPaths

  • getFile

  • downloadToFile

  • downloadLink

  • deleteFile

  • appendToFile

  • flushToFile

  • uploadFromFile

  • upload

  • openQueryInputStream

  • createFile

  • deleteDirectory

| | DataLakeOperationsDefinition | | CamelAzureStorageDataLakeFileSystemName (producer) Constant: FILESYSTEM_NAME | operation을 수행할 Azure Data Lake 파일시스템의 이름이에요. 파일시스템 이름은 반드시 전부 소문자여야 해요. | | String | | CamelAzureStorageDataLakeDirectoryName (producer) Constant: DIRECTORY_NAME | operation을 수행할 Azure Data Lake 디렉터리의 이름이에요. | | String | | CamelAzureStorageDataLakeFileName (producer) Constant: FILE_NAME | operation을 수행할 Azure Data Lake 파일의 이름이에요. | | String | | CamelAzureStorageDataLakeMetadata (from both) Constant: METADATA | 파일에 붙일 메타데이터예요. | | Map | | CamelAzureStorageDataLakePublicAccessType (producer) Constant: PUBLIC_ACCESS_TYPE | DataLakeServiceAsyncClient 객체에서 listFileSystemsSegment 호출의 동작을 설정하는 데 쓸 수 있는 옵션을 정의해요. | | PublicAccessType | | CamelAzureStorageDataLakeRawHttpHeaders (consumer) Constant: RAW_HTTP_HEADERS | 사용자가 활용할 수 있는, 파싱되지 않은 HTTP 헤더예요. | | HttpHeaders | | CamelAzureStorageDataLakeRequestCondition (producer) Constant: DATALAKE_REQUEST_CONDITION | 다양한 요청의 성공적인 수행을 현재 조건들로 제한하는 값들을 담고 있어요. 이 조건들은 완전히 선택 사항이에요. | | DataLakeRequestConditions | | CamelAzureStorageDataLakeListPathOptions (producer) Constant: LIST_PATH_OPTIONS | DataLakeFileSystemClient 객체에서 listContainersSegment 호출의 동작을 설정하는 데 쓸 수 있는 옵션을 정의해요. null을 넘길 수도 있어요. | | ListPathOptions | | CamelAzureStorageDataLakePath (producer) Constant: PATH | upload operation에 쓸 파일의 경로예요. | | String | | CamelAzureStorageDataLakeRecursive (producer) Constant: RECURSIVE | listContainersSegment 호출이 모든 경로를 재귀적으로 포함할지 지정해요. | | Boolean | | CamelAzureStorageDataLakeMaxResults (producer) Constant: MAX_RESULTS | 모든 BlobPrefix 요소를 포함해 반환할 blob의 최대 개수를 지정해요. | | Integer | | CamelAzureStorageDataLakeUserPrincipalNameReturned (producer) Constant: USER_PRINCIPAL_NAME_RETURNED | user principal의 이름을 반환할지 지정해요. | | Boolean | | CamelAzureStorageDataLakeRegex (producer) Constant: REGEX | 지정한 정규 표현식에 맞는 파일만 결과로 반환하도록 필터링해요. | | String | | CamelAzureStorageDataLakeFileDir (producer) Constant: FILE_DIR | 파일을 내려받을 디렉터리예요. | | String | | CamelAzureStorageDataLakeAccessTier (consumer) Constant: ACCESS_TIER | 파일의 액세스 티어예요. | | AccessTier | | CamelAzureStorageDataLakeContentMD5 (producer) Constant: CONTENT_MD5 | 콘텐츠의 MD5 해시예요. 이 해시는 전송 중 파일 무결성을 검증하는 데 쓰여요. | | byte[] | | CamelAzureStorageDataLakeFileRange (producer) Constant: FILE_RANGE | 파일 위의 바이트 범위를 표현한 것으로, 보통 download operation에서 쓰여요. FileRange 값으로 null을 넘기면 파일 전체 범위가 기본값이 돼요. | | FileRange | | CamelAzureStorageDataLakeParallelTransferOptions (producer) Constant: PARALLEL_TRANSFER_OPTIONS | 데이터 전송 operation을 병렬화하는 데 쓰는 설정이에요. | | ParallelTransferOptions | | CamelAzureStorageDataLakeOpenOptions (producer) Constant: OPEN_OPTIONS | 파일을 어떻게 열고 만들지 설정하는 OpenOption의 집합이에요. | | Set | | CamelAzureStorageDataLakeAccessTierChangeTime (consumer) Constant: ACCESS_TIER_CHANGE_TIME | blob의 액세스 티어가 마지막으로 바뀐 날짜·시간이에요. | | OffsetDateTime | | CamelAzureStorageDataLakeArchiveStatus (consumer) Constant: ARCHIVE_STATUS | 파일의 아카이브 상태예요. | | ArchiveStatus | | CamelAzureStorageDataLakeCacheControl (consumer) Constant: CACHE_CONTROL | 파일에 지정된 캐시 제어(cache control)예요. | | String | | CamelAzureStorageDataLakeContentDisposition (consumer) Constant: CONTENT_DISPOSITION | 파일에 지정된 content disposition이에요. | | String | | CamelAzureStorageDataLakeContentEncoding (consumer) Constant: CONTENT_ENCODING | 파일에 지정된 콘텐츠 인코딩이에요. | | String | | CamelAzureStorageDataLakeContentLanguage (consumer) Constant: CONTENT_LANGUAGE | 파일에 지정된 콘텐츠 언어예요. | | String | | CamelAzureStorageDataLakeContentType (consumer) Constant: CONTENT_TYPE | 파일에 지정된 콘텐츠 타입이에요. | | String | | CamelAzureStorageDataLakeCopyCompletionTime (consumer) Constant: COPY_COMPLETION_TIME | 이 파일이 대상 파일이었던 마지막 Copy Blob 시도의 완료 시간이에요. | | OffsetDateTime | | CamelAzureStorageDataLakeCopyId (consumer) Constant: COPY_ID | 이 copy operation의 문자열 식별자예요. | | String | | CamelAzureStorageDataLakeCopyProgress (consumer) Constant: COPY_PROGRESS | 이 파일이 대상 파일이었던 마지막 Copy Blob 시도에서 복사된 바이트 수와 소스의 전체 바이트 수를 담고 있어요. | | String | | CamelAzureStorageDataLakeCopySource (consumer) Constant: COPY_SOURCE | 이 파일이 대상 파일이었던 마지막 Copy Blob 시도에서 쓰인 원본 파일을 지정하는, 최대 2KB 길이의 URL이에요. | | String | | CamelAzureStorageDataLakeCopyStatus (consumer) Constant: COPY_STATUS |

파일에 수행된 마지막 copy operation의 상태예요.

Enum values:

  • pending

  • success

  • aborted

  • failed

| | CopyStatusType | | CamelAzureStorageDataLakeCopyStatusDescription (consumer) Constant: COPY_STATUS_DESCRIPTION | copy 상태에 대한 설명이에요. | | String | | CamelAzureStorageDataLakeCreationTime (consumer) Constant: CREATION_TIME | 파일의 생성 시간이에요. | | OffsetDateTime | | CamelAzureStorageDataLakeEncryptionKeySha256 (consumer) Constant: ENCRYPTION_KEY_SHA_256 | 파일을 암호화하는 데 쓴 암호화 키의 SHA-256 해시예요. | | String | | CamelAzureStorageDataLakeETag (consumer) Constant: E_TAG | 파일의 E Tag예요. | | String | | CamelAzureStorageDataLakeFileSize (consumer) Constant: FILE_SIZE | 파일의 크기예요. | | Long | | CamelAzureStorageDataLakeLastModified (consumer) Constant: LAST_MODIFIED | 파일이 마지막으로 수정된 날짜·시간이에요. | | OffsetDateTime | | CamelAzureStorageDataLakeLeaseDuration (consumer) Constant: LEASE_DURATION |

파일에 설정된 임대(lease)의 타입이에요.

Enum values:

  • infinite

  • fixed

| | LeaseDurationType | | CamelAzureStorageDataLakeLeaseState (consumer) Constant: LEASE_STATE |

파일 임대의 state예요.

Enum values:

  • available

  • leased

  • expired

  • breaking

  • broken

| | LeaseStateType | | CamelAzureStorageDataLakeLeaseStatus (consumer) Constant: LEASE_STATUS |

파일 임대의 status예요.

Enum values:

  • locked

  • unlocked

| | LeaseStatusType | | CamelAzureStorageDataLakeIncrementalCopy (producer) Constant: INCREMENTAL_COPY | 파일이 증분 복사(incremental copy)됐는지 나타내는 플래그예요. | | Boolean | | CamelAzureStorageDataLakeServerEncrypted (consumer) Constant: SERVER_ENCRYPTED | 파일 콘텐츠가 서버에서 암호화돼 있는지 나타내는 플래그예요. | | Boolean | | CamelAzureStorageDataLakeDownloadLinkExpiration (producer) Constant: DOWNLOAD_LINK_EXPIRATION | 다운로드 링크의 만료 시간을 설정해요. | | Long | | CamelAzureStorageDataLakeDownloadLink (consumer) Constant: DOWNLOAD_LINK | 데이터 레이크에서 파일을 내려받을 때 쓸 수 있는 링크예요. | | String | | CamelAzureStorageDataLakeFileOffset (producer) Constant: FILE_OFFSET | 데이터가 덧붙여질 위치예요. | | Long | | CamelAzureStorageDataLakeLeaseId (producer) Constant: LEASE_ID | lease id를 설정하면, 제공한 임대가 파일의 활성 임대와 일치하지 않을 때 요청이 실패해요. | | String | | CamelAzureStorageDataLakePathHttpHeaders (producer) Constant: PATH_HTTP_HEADERS | operation 집합을 위한 추가 파라미터예요. | | PathHttpHeaders | | CamelAzureStorageDataLakeRetainCommitedData (producer) Constant: RETAIN_UNCOMMITED_DATA | operation 이후에도 커밋되지 않은 데이터를 유지할지 여부를 결정해요. | | Boolean | | CamelAzureStorageDataLakeClose (producer) Constant: CLOSE | 파일 변경 이벤트가 발생했을 때 완료(true)를 뜻하는지, 수정(false)을 뜻하는지 여부예요. | | Boolean | | CamelAzureStorageDataLakePosition (producer) Constant: POSITION | 모든 데이터가 기록된 뒤의 파일 길이예요. | | Long | | CamelAzureStorageDataLakeExpression (producer) Constant: EXPRESSION | 파일에 대한 쿼리 표현식이에요. | | String | | CamelAzureStorageDataLakeInputSerialization (producer) Constant: INPUT_SERIALIZATION | 파일 쿼리 요청의 입력 직렬화를 정의해요. FileQueryJsonSerialization 또는 FileQueryDelimitedSerialization 중 하나예요. | | FileQuerySerialization | | CamelAzureStorageDataLakeOutputSerialization (producer) Constant: OUTPUT_SERIALIZATION | 파일 쿼리 요청의 출력 직렬화를 정의해요. FileQueryJsonSerialization 또는 FileQueryDelimitedSerialization 중 하나예요. | | FileQuerySerialization | | CamelAzureStorageDataLakeErrorConsumer (producer) Constant: ERROR_CONSUMER | 파일 쿼리의 에러 consumer를 설정해요. | | Consumer | | CamelAzureStorageDataLakeProgressConsumer (producer) Constant: PROGRESS_CONSUMER | 파일 쿼리의 진행률(progress) consumer를 설정해요. | | Consumer | | CamelAzureStorageDataLakeQueryOptions (producer) Constant: QUERY_OPTIONS | 파일 쿼리의 선택적 파라미터예요. | | FileQueryOptions | | CamelAzureStorageDataLakePermission (producer) Constant: PERMISSION | 파일의 permission을 설정해요. | | String | | CamelAzureStorageDataLakeUmask (producer) Constant: UMASK | 파일의 umask를 설정해요. | | String | | CamelAzureStorageDataLakeFileClient (producer) Constant: FILE_CLIENT | 사용할 파일 클라이언트를 설정해요. | | DataLakeFileClient | | CamelAzureStorageDataLakeFlush (producer) Constant: FLUSH | append 시 flush를 수행할지 설정해요. | | Boolean |

인증 방법 (Methods of authentication)

이 컴포넌트를 쓰려면 아래 credentialType 파라미터 중 최소 하나는 제공해야 해요:

  • SHARED_KEY_CREDENTIAL: Azure 계정의 accountName과 accessKey를 제공하거나, sharedKeyCredential 옵션에 넣을 수 있는 StorageSharedKeyCredential 인스턴스를 제공해요.

  • CLIENT_SECRET: clientSecretCredential 옵션에 넣을 수 있는 ClientSecretCredential 인스턴스를 제공하거나, Azure Active Directory 인증을 위해 accountName, clientId, clientSecret, tenantId를 제공해요.

  • SERVICE_CLIENT_INSTANCE: serviceClient 옵션에 넣을 수 있는 DataLakeServiceClient 인스턴스를 제공해요.

  • AZURE_IDENTITY: 기본 Azure 자격 증명 공급자 체인(Default Azure Credential Provider Chain)을 사용해요.

  • AZURE_SAS: SAS 메커니즘을 쓰려고 sasSignature 또는 sasCredential 파라미터를 제공해요.

기본값은 CLIENT_SECRET이에요.

사용법 (Usage)

예를 들어 camelTesting 스토리지 계정의 filesystem에 들어 있는 test.txt 파일 내용을 내려받으려면 다음 스니펫을 쓰면 돼요:

from("azure-storage-datalake:camelTesting/filesystem?fileName=test.txt&accountKey=key")
    .to("file://fileDirectory");
<route>
    <from uri="azure-storage-datalake:camelTesting/filesystem?fileName=test.txt&amp;accountKey=key"/>
    <to uri="file://fileDirectory"/>
</route>
- route:
    from:
      uri: azure-storage-datalake:camelTesting/filesystem
      parameters:
        fileName: test.txt
        accountKey: key
      steps:
        - to:
            uri: file://fileDirectory

서비스 클라이언트 자동 감지 (Automatic detection of a service client)

이 컴포넌트는 레지스트리에 DataLakeServiceClient 빈이 있는지 자동으로 감지할 수 있어요. 그래서 레지스트리에 DataLakeServiceClient 타입의 인스턴스가 하나뿐이라면 그 인스턴스가 기본 클라이언트로 자동 사용돼요. URI 파라미터로 일일이 명시하지 않아도 되죠.

Azure Storage DataLake 프로듀서 operation (Producer Operations)

Azure Storage DataLake가 지원하는 다양한 operation들은 다음과 같아요:

서비스 레벨 operation

이 operation들에는 accountName 옵션이 필요해요

Operation Description
listFileSystem 지정한 Azure 계정에 존재하는 모든 파일시스템을 나열해요.

파일시스템 레벨 operation

이 operation들에는 accountName과 fileSystemName 옵션이 필요해요

Operation Description
createFileSystem 스토리지 계정에 새 파일시스템을 만들어요
deleteFileSystem 스토리지 계정에서 지정한 파일시스템을 삭제해요
listPaths 지정한 파일시스템에서 주어진 경로 안의 모든 파일 목록을 폴더 구조를 평탄화해서 반환해요

디렉터리 레벨 operation

이 operation들에는 accountName, fileSystemName, directoryName 옵션이 필요해요

Operation Description
createFile 파일시스템 안의 지정한 디렉터리에 새 파일을 만들어요
deleteDirectory 파일시스템에서 지정한 디렉터리를 삭제해요

파일 레벨 operation

이 operation들에는 accountName, fileSystemName, fileName 옵션이 필요해요

Operation Description
getFile 파일의 내용을 가져와요
downloadToFile 파일시스템에서 파일 전체를 fileDir로 지정한 경로에 내려받아요.
downloadLink SAS(Shared Access Signature)로 지정한 파일의 다운로드 링크를 만들어요. 링크의 만료 시간을 지정할 수 있고, 지정하지 않으면 기본으로 1시간이 적용돼요.
deleteFile 지정한 파일을 삭제해요.
appendToFile 넘긴 데이터를 파일시스템의 지정한 파일에 덧붙여요(append). append 뒤에는 flush 명령이 필요해요.
flushToFile 지정한 파일에 이미 append된 데이터를 flush해요.
openQueryInputStream 엔드포인트에 넘긴 쿼리를 바탕으로 InputStream을 열어요. 이 operation을 쓰려면 먼저 구독에 query acceleration 기능을 등록해야 해요.

이 operation들의 사용 방법은 아래 예제 섹션에서 더 자세히 확인할 수 있어요

예제 (Examples)

Consumer 예제 (Consumer Examples)

스토리지 데이터 레이크의 파일을 file 컴포넌트를 써서 파일로 소비하려면 이렇게 하면 돼요:

from("azure-storage-datalake:cameltesting/filesystem?fileName=test.txt&accountKey=yourAccountKey")
    .to("file:/filelocation");
<route>
  <from uri="azure-storage-datalake:cameltesting/filesystem?fileName=test.txt&amp;accountKey=yourAccountKey"/>
  <to uri="file:/filelocation"/>
</route>
- route:
    from:
      uri: azure-storage-datalake:cameltesting/filesystem
      parameters:
        fileName: test.txt
        accountKey: yourAccountKey
      steps:
        - to:
            uri: file:/filelocation

file 컴포넌트를 쓰지 않고 바로 파일에 쓸 수도 있어요. 이렇게 하려면 머신에 저장할 경로를 fileDir 옵션으로 지정해야 해요.

from("azure-storage-datalake:cameltesting/filesystem?fileName=test.txt&accountKey=yourAccountKey&fileDir=/test/directory")
    .to("mock:results");
<route>
  <from uri="azure-storage-datalake:cameltesting/filesystem?fileName=test.txt&amp;accountKey=yourAccountKey&amp;fileDir=/test/directory"/>
  <to uri="mock:results"/>
</route>
- route:
    from:
      uri: azure-storage-datalake:cameltesting/filesystem
      parameters:
        fileName: test.txt
        accountKey: yourAccountKey
        fileDir: /test/directory
      steps:
        - to:
            uri: mock:results

이 컴포넌트는 batch consumer도 지원해요. 그래서 파일을 소비할 위치 경로를 지정해서 파일시스템에서 여러 파일을 한 번에 소비할 수 있어요.

from("azure-storage-datalake:cameltesting/filesystem?accountKey=yourAccountKey&fileDir=/test/directory&path=abc/test")
    .to("mock:results");
<route>
  <from uri="azure-storage-datalake:cameltesting/filesystem?accountKey=yourAccountKey&amp;fileDir=/test/directory&amp;path=abc/test"/>
  <to uri="mock:results"/>
</route>
- route:
    from:
      uri: azure-storage-datalake:cameltesting/filesystem
      parameters:
        accountKey: yourAccountKey
        fileDir: /test/directory
        path: abc/test
      steps:
        - to:
            uri: mock:results

Producer 예제 (Producer Examples)

  • listFileSystem

Java 전용: ListFileSystemsOptions SDK 타입을 사용해요

from("direct:start")
    .process(exchange -> {
        exchange.getIn().setHeader(DataLakeConstants.LIST_FILESYSTEMS_OPTIONS,
                new ListFileSystemsOptions().setMaxResultsPerPage(10));
    })
    .to("azure-storage-datalake:cameltesting?operation=listFileSystem&serviceClient=#serviceClient")
    .to("mock:results");
  • createFileSystem
from("direct:start")
    .setHeader("CamelAzureStorageDataLakeFileSystemName", constant("test1"))
    .to("azure-storage-datalake:cameltesting?operation=createFileSystem&serviceClient=#serviceClient")
    .to("mock:results");
<route>
  <from uri="direct:start"/>
  <setHeader name="CamelAzureStorageDataLakeFileSystemName">
    <constant>test1</constant>
  </setHeader>
  <to uri="azure-storage-datalake:cameltesting?operation=createFileSystem&amp;serviceClient=#serviceClient"/>
  <to uri="mock:results"/>
</route>
- route:
    from:
      uri: direct:start
      steps:
        - setHeader:
            name: CamelAzureStorageDataLakeFileSystemName
            constant: test1
        - to:
            uri: azure-storage-datalake:cameltesting
            parameters:
              operation: createFileSystem
              serviceClient: "#serviceClient"
        - to:
            uri: mock:results
  • deleteFileSystem
from("direct:start")
    .setHeader("CamelAzureStorageDataLakeFileSystemName", constant("test1"))
    .to("azure-storage-datalake:cameltesting?operation=deleteFileSystem&serviceClient=#serviceClient")
    .to("mock:results");
<route>
  <from uri="direct:start"/>
  <setHeader name="CamelAzureStorageDataLakeFileSystemName">
    <constant>test1</constant>
  </setHeader>
  <to uri="azure-storage-datalake:cameltesting?operation=deleteFileSystem&amp;serviceClient=#serviceClient"/>
  <to uri="mock:results"/>
</route>
- route:
    from:
      uri: direct:start
      steps:
        - setHeader:
            name: CamelAzureStorageDataLakeFileSystemName
            constant: test1
        - to:
            uri: azure-storage-datalake:cameltesting
            parameters:
              operation: deleteFileSystem
              serviceClient: "#serviceClient"
        - to:
            uri: mock:results
  • listPaths

Java 전용: ListPathsOptions SDK 타입을 사용해요

from("direct:start")
    .process(exchange -> {
        exchange.getIn().setHeader(DataLakeConstants.LIST_PATH_OPTIONS,
                new ListPathsOptions().setPath("/main"));
    })
    .to("azure-storage-datalake:cameltesting/filesystem?operation=listPaths&serviceClient=#serviceClient")
    .to("mock:results");
  • getFile

이 operation은 두 가지 방법으로 할 수 있어요. exchange 바디에 OutputStream을 설정하거나:

Java 전용: 기록할 파일 콘텐츠의 OutputStream을 설정해요

from("direct:start")
    .process(exchange -> {
        exchange.getIn().setBody(outputStream);
    })
    .to("azure-storage-datalake:cameltesting/filesystem?operation=getFile&fileName=test.txt&serviceClient=#serviceClient")
    .to("mock:results");

또는 바디를 설정하지 않으면, Azure 포털에서 query acceleration을 이미 등록해 뒀다는 전제 하에 operation이 InputStream을 돌려줘요.

Java 전용: 파일 콘텐츠를 InputStream으로 읽어 와요

from("direct:start")
    .to("azure-storage-datalake:cameltesting/filesystem?operation=getFile&fileName=test.txt&serviceClient=#serviceClient")
    .process(exchange -> {
        InputStream inputStream = exchange.getMessage().getBody(InputStream.class);
        System.out.println(IOUtils.toString(inputStream, StandardCharsets.UTF_8.name()));
    })
    .to("mock:results");
  • deleteFile
from("direct:start")
    .to("azure-storage-datalake:cameltesting/filesystem?operation=deleteFile&fileName=test.txt&serviceClient=#serviceClient")
    .to("mock:results");
<route>
    <from uri="direct:start"/>
    <to uri="azure-storage-datalake:cameltesting/filesystem?operation=deleteFile&amp;fileName=test.txt&amp;serviceClient=#serviceClient"/>
    <to uri="mock:results"/>
</route>
- route:
    from:
      uri: direct:start
      steps:
        - to:
            uri: azure-storage-datalake:cameltesting/filesystem
            parameters:
              operation: deleteFile
              fileName: test.txt
              serviceClient: "#serviceClient"
        - to:
            uri: mock:results
  • downloadToFile
from("direct:start")
    .to("azure-storage-datalake:cameltesting/filesystem?operation=downloadToFile&fileName=test.txt&fileDir=/test/mydir&serviceClient=#serviceClient")
    .to("mock:results");
<route>
    <from uri="direct:start"/>
    <to uri="azure-storage-datalake:cameltesting/filesystem?operation=downloadToFile&amp;fileName=test.txt&amp;fileDir=/test/mydir&amp;serviceClient=#serviceClient"/>
    <to uri="mock:results"/>
</route>
- route:
    from:
      uri: direct:start
      steps:
        - to:
            uri: azure-storage-datalake:cameltesting/filesystem
            parameters:
              operation: downloadToFile
              fileName: test.txt
              fileDir: /test/mydir
              serviceClient: "#serviceClient"
        - to:
            uri: mock:results
  • downloadLink

Java 전용: 응답 바디에서 생성된 다운로드 링크를 처리해요

from("direct:start")
    .to("azure-storage-datalake:cameltesting/filesystem?operation=downloadLink&fileName=test.txt&serviceClient=#serviceClient")
    .process(exchange -> {
        String link = exchange.getMessage().getBody(String.class);
        System.out.println(link);
    })
    .to("mock:results");
  • appendToFile

Java 전용: append할 데이터의 InputStream 바디를 만들어요

from("direct:start")
    .process(exchange -> {
        final String data = "test data";
        final InputStream inputStream = new ByteArrayInputStream(data.getBytes(StandardCharsets.UTF_8));
        exchange.getIn().setBody(inputStream);
    })
    .to("azure-storage-datalake:cameltesting/filesystem?operation=appendToFile&fileName=test.txt&serviceClient=#serviceClient")
    .to("mock:results");
  • flushToFile
from("direct:start")
    .setHeader("CamelAzureStorageDataLakePosition", constant(0))
    .to("azure-storage-datalake:cameltesting/filesystem?operation=flushToFile&fileName=test.txt&serviceClient=#serviceClient")
    .to("mock:results");
<route>
  <from uri="direct:start"/>
  <setHeader name="CamelAzureStorageDataLakePosition">
    <constant>0</constant>
  </setHeader>
  <to uri="azure-storage-datalake:cameltesting/filesystem?operation=flushToFile&amp;fileName=test.txt&amp;serviceClient=#serviceClient"/>
  <to uri="mock:results"/>
</route>
- route:
    from:
      uri: direct:start
      steps:
        - setHeader:
            name: CamelAzureStorageDataLakePosition
            constant: 0
        - to:
            uri: azure-storage-datalake:cameltesting/filesystem
            parameters:
              operation: flushToFile
              fileName: test.txt
              serviceClient: "#serviceClient"
        - to:
            uri: mock:results
  • openQueryInputStream

이 operation을 쓰려면 Azure 포털에서 query acceleration을 미리 등록해 뒀어야 해요.

Java 전용: FileQueryOptions SDK 타입을 사용해요

from("direct:start")
    .process(exchange -> {
        exchange.getIn().setHeader(DataLakeConstants.QUERY_OPTIONS,
                new FileQueryOptions("SELECT * from BlobStorage"));
    })
    .to("azure-storage-datalake:cameltesting/filesystem?operation=openQueryInputStream&fileName=test.txt&serviceClient=#serviceClient")
    .to("mock:results");
  • upload

Java 전용: 업로드할 데이터의 InputStream 바디를 만들어요

from("direct:start")
    .process(exchange -> {
        final String data = "test data";
        final InputStream inputStream = new ByteArrayInputStream(data.getBytes(StandardCharsets.UTF_8));
        exchange.getIn().setBody(inputStream);
    })
    .to("azure-storage-datalake:cameltesting/filesystem?operation=upload&fileName=test.txt&serviceClient=#serviceClient")
    .to("mock:results");
  • uploadFromFile
from("direct:start")
    .setHeader("CamelAzureStorageDataLakePath", constant("test/file.txt"))
    .to("azure-storage-datalake:cameltesting/filesystem?operation=uploadFromFile&fileName=test.txt&serviceClient=#serviceClient")
    .to("mock:results");
<route>
  <from uri="direct:start"/>
  <setHeader name="CamelAzureStorageDataLakePath">
    <constant>test/file.txt</constant>
  </setHeader>
  <to uri="azure-storage-datalake:cameltesting/filesystem?operation=uploadFromFile&amp;fileName=test.txt&amp;serviceClient=#serviceClient"/>
  <to uri="mock:results"/>
</route>
- route:
    from:
      uri: direct:start
      steps:
        - setHeader:
            name: CamelAzureStorageDataLakePath
            constant: test/file.txt
        - to:
            uri: azure-storage-datalake:cameltesting/filesystem
            parameters:
              operation: uploadFromFile
              fileName: test.txt
              serviceClient: "#serviceClient"
        - to:
            uri: mock:results
  • createFile
from("direct:start")
    .setHeader("CamelAzureStorageDataLakeDirectoryName", constant("test/file/"))
    .to("azure-storage-datalake:cameltesting/filesystem?operation=createFile&fileName=test.txt&serviceClient=#serviceClient")
    .to("mock:results");
<route>
  <from uri="direct:start"/>
  <setHeader name="CamelAzureStorageDataLakeDirectoryName">
    <constant>test/file/</constant>
  </setHeader>
  <to uri="azure-storage-datalake:cameltesting/filesystem?operation=createFile&amp;fileName=test.txt&amp;serviceClient=#serviceClient"/>
  <to uri="mock:results"/>
</route>
- route:
    from:
      uri: direct:start
      steps:
        - setHeader:
            name: CamelAzureStorageDataLakeDirectoryName
            constant: "test/file/"
        - to:
            uri: azure-storage-datalake:cameltesting/filesystem
            parameters:
              operation: createFile
              fileName: test.txt
              serviceClient: "#serviceClient"
        - to:
            uri: mock:results
  • deleteDirectory
from("direct:start")
    .setHeader("CamelAzureStorageDataLakeDirectoryName", constant("test/file/"))
    .to("azure-storage-datalake:cameltesting/filesystem?operation=deleteDirectory&serviceClient=#serviceClient")
    .to("mock:results");
<route>
  <from uri="direct:start"/>
  <setHeader name="CamelAzureStorageDataLakeDirectoryName">
    <constant>test/file/</constant>
  </setHeader>
  <to uri="azure-storage-datalake:cameltesting/filesystem?operation=deleteDirectory&amp;serviceClient=#serviceClient"/>
  <to uri="mock:results"/>
</route>
- route:
    from:
      uri: direct:start
      steps:
        - setHeader:
            name: CamelAzureStorageDataLakeDirectoryName
            constant: "test/file/"
        - to:
            uri: azure-storage-datalake:cameltesting/filesystem
            parameters:
              operation: deleteDirectory
              serviceClient: "#serviceClient"
        - to:
            uri: mock:results

테스트 (Testing)

컴포넌트를 수정할 때는 단위 테스트와 통합 테스트를 모두 돌려 보세요. 변경이나 버전 업그레이드가 문제를 일으킬 수 있거든요. 컴포넌트의 모든 테스트를 실행하려면 Azure accountName과 accessKey가 필요해요. 준비되면 다음 maven 명령으로 이 컴포넌트 디렉터리에서 전체 테스트를 돌릴 수 있어요

mvn verify -Dazure.storage.account.name=<accountName> -Dazure.storage.account.key=<accessKey>

다음 명령을 쓰면 통합 테스트를 건너뛰고 기본 단위 테스트만 실행할 수 있어요

mvn test

더 알아보기 (Learn more)

  • Azure 문서 포털 — Azure Storage 계정 준비와 Data Lake Storage Gen2 개념은 Azure 공식 문서에서 확인할 수 있어요.
  • 처음 연결할 때는 위의 인증 방법(Methods of authentication) 섹션에서 credentialType을 하나 골라 필요한 값을 채워 주세요. 기본값은 CLIENT_SECRET이에요.
  • operation별 producer 예제는 위의 예제(Examples) 섹션에 Java·XML·YAML 세 가지 형태로 정리돼 있으니, 라우트를 작성할 때 그대로 참고하면 좋아요.