Java에서 eventhub의 메시지를 소비하기 위해 EventProcessorHost를 사용하려고합니다. here1 및 here2 만 제공됩니다 다음 단계 내가 오류가 아래 얻고 코드를 실행하면 ..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
자세한 내용 :에 언급 된
만든 새로운 스토리지 계정 블로그 및 또한 blob을 만들었습니다.
EventProcessor 클래스 및 ErrorNotificationHandler 클래스는 Microsoft 워드 프로세서에서 언급 한 것과 같습니다. 레지스터는 다음과 같습니다 호출
코드 ...
주
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에서 저장소에 대한 특정 시간 초과를 증명할 수 있는지 확실하지 않습니다. 어떤 도움을 주셔서 감사합니다.
오류 로그에 따르면 오류가 발생했을 때 프로세스가 아직 IEventProcessor.onEvents 메서드에 도착하지 않았습니다. setReceiveTimeOut가 문제를 해결하지 못했습니까? –
Jay님께 감사드립니다. 어떤 setReceiveTimeOut도 12 분을 넣었음에도 문제를 해결하지 못했습니다. 내가 설정할 필요가있는 다른 타임 아웃이 있는지 확실하지 않습니다. – user8828251
문제를 재현하고이를 해결하는 방법을 알아 봅니다. (전에 비슷한 질문을 게시했음을 알았습니다.) –