0

Java에서 eventhub의 메시지를 소비하기 위해 EventProcessorHost를 사용하려고합니다. here1here2 만 제공됩니다 다음 단계 내가 오류가 아래 얻고 코드를 실행하면 ..EventProcessorHost 등록시 오류가 발생했습니다.

Registering host named <name> 
 

 
Failure while registering: java.util.concurrent.ExecutionException: com.microsoft.azure.storage.StorageException: The client could not finish the operation within specified maximum execution timeout. 
 
    Press enter to stop

자세한 내용 :에 언급 된

  1. 만든 새로운 스토리지 계정 블로그 및 또한 blob을 만들었습니다.

  2. EventProcessor 클래스 및 ErrorNotificationHandler 클래스는 Microsoft 워드 프로세서에서 언급 한 것과 같습니다. 레지스터는 다음과 같습니다 호출

  3. 코드 ...

final String consumerGroupName = "test"; 
 
final String namespaceName = "--namespace--"; 
 
final String eventHubName = "--eventhub name --"; 
 
final String sasKeyName = "--saskey name--"; 
 
final String sasKey = "--sas-key"; 
 
final String containerName = "--container name --"; 
 
final String storageAccountName = "--storage account name --"; 
 
final String storageAccountKey = "--storage -- account key--"; 
 
final String connectionString = "--eventhub connection string copied from azure portal --"; 
 
final String storageConString = "--storage connection string copied from azure portal --"; 
 

 
    EventProcessorHost host = new EventProcessorHost(
 
    namespaceName, // Also tried with full name <namespace name>.servicebus.windows.net 
 
    eventHubName, 
 
    consumerGroupName, 
 
    connectionString, 
 
    storageConString, 
 
    containerName 
 
    //  "<blobprefix>" Also tried with blob prefix 
 
    ); 
 

 
    System.out.println("Registering host named " + host.getHostName()); 
 
    EventProcessorOptions options = new EventProcessorOptions(); 
 
    options.setReceiveTimeOut(Duration.ofMinutes(12 L)); 
 
    options.setExceptionNotification(new ErrorNotificationHandler()); 
 

 
    try { 
 

 
    host.registerEventProcessor(EventProcessor.class, options).get(15, TimeUnit.MINUTES); 
 

 
    } catch (Exception e) { 
 
    System.out.print("Failure while registering: "); 
 
    if (e instanceof ExecutionException) { 
 
    Throwable inner = e.getCause(); 
 
    System.out.println(inner.toString()); 
 
    } else { 
 
    System.out.println(e.toString()); 
 
    } 
 
    }
: 블로그는 EventProcessorHost에 대한 생성자를 사용 중지했다.

온라인으로 오류를 검색했는데 저장소 시간 초과를 늘리는 것이지만 어떻게 EventProcessorHost에서 저장소에 대한 특정 시간 초과를 증명할 수 있는지 확실하지 않습니다. 어떤 도움을 주셔서 감사합니다.

+0

오류 로그에 따르면 오류가 발생했을 때 프로세스가 아직 IEventProcessor.onEvents 메서드에 도착하지 않았습니다. setReceiveTimeOut가 문제를 해결하지 못했습니까? –

+0

Jay님께 감사드립니다. 어떤 setReceiveTimeOut도 12 분을 넣었음에도 문제를 해결하지 못했습니다. 내가 설정할 필요가있는 다른 타임 아웃이 있는지 확실하지 않습니다. – user8828251

+0

문제를 재현하고이를 해결하는 방법을 알아 봅니다. (전에 비슷한 질문을 게시했음을 알았습니다.) –

답변

1

나는 이벤트 허브에서 메시지를 받기 위해 official document을 따라 갔으며 잘 작동한다.

enter image description here

메시지 I 구성된 푸른 물방울 보관소에 보관 하였다.

enter image description here

귀하의 설명에 따르면, 시간 제한 예외는 여전히 EventProcessorOptions 12 분에 ReceiveTimeOut을 설정하더라도 발생했습니다. 내 경험에 의하면 메시지가 하나씩 수신 되더라도 오랜 시간이 걸리는 데는 12 분이 걸리지 않습니다. 그리고 일반적으로 응용 프로그램에서 너무 오래 시간 제한을 설정할 수 없습니다. 그래서 나는 오류가 더 이상 SDK 수준에서 없다고 생각합니다. 네트워크 환경 문제 일 수 있습니다.

아시다시피, 이벤트 허브 송신 클라이언트는 HTTP protocol을 사용하며 방화벽에 의해 차단되지 않습니다. EPH 메시지 수신 클라이언트는 본질적으로 TCP protocol 인 AMQP 프로토콜을 사용하며 프록시 서버 설정 또는 방화벽으로 제한됩니다. Eph 클라이언트가 이벤트 허브에 연결되어 있지 않다고 가정합니다.

실제 네트워크 환경을 알 수 없으므로 프록시 설정이나 방화벽 목록을 확인하여 네트워크 환경 문제를 해결하는 것이 좋습니다.

아무쪼록 알려주세요.

+0

감사합니다. 내가 작동하도록 경우에 그것을 테스트하기 위해 hight 그냥 ReceiveTimeOut을 설정합니다. 내가 프록시 설정을 확인합니다, 당신이 내가 알고 있어야한다고 알고 특정 프록시 설정이 무엇입니까? – user8828251

+1

@ user8828251 SOCK4/5 프록시 (지원 TCP 프로토콜)인지 여부에 관계없이 코드 또는 시스템에서 프록시 설정을 확인할 수 있습니다. –

+0

내 컴퓨터에서 프록시 설정을 보려고했지만 특정 설정을 선택하지 않았습니다. 여전히 작동하지 않습니다. 특정 프록시 설정을 선택해야합니까? – user8828251