Azure Event Hub(Azure事件中心) 是大数据流式处理平台和事件引入服务。 它可以每秒接收和处理数百万个事件。在我们的使用中,需要代码编写的是两个部分:事件生产者和事件接收者

  • 事件生成者:向事件中心发送数据的所有实体。 事件发布者可以使用 HTTPS、AMQP 1.0 或 Apache Kafka(1.0 和更高版本)发布事件。
  • 事件接收者:从事件中心读取事件数据的所有实体。 所有事件中心使用者通过 AMQP 1.0 会话进行连接。 事件中心服务在事件变得可用时通过会话来提供事件。 所有 Kafka 使用者都通过 Kafka 协议 1.0 及更高版本进行连接。

下图显示了事件中心流处理体系结构:

(其他组件说明:https://docs.azure.cn/zh-cn/event-hubs/event-hubs-about#key-architecture-components)

问题描述

在使用事件生产者或接收者时,都需要与Event Hub服务建立连接。那么只要建立了连接,都需要考虑连接空闲超时参数。当发生Timout后,EventHubClient的表现是什么呢?有什么日志输出呢?同时,当新的消息需要发送时,EventHubClient时如何重建的连接呢? 重建连接耗时多长呢?

问题分析

以上问题,都可以通过调试EventHubClient的代码日志来分析。

实验步骤:

准备条件:参考文档,构建EventHub的发送消息代码:

1) 在初始化EventHubClient对象时,使用默认的OperationTimout时间(60秒)

2) 在发送第一条消息前,使线程睡眠65秒。验证EventHubClient对象超时后SDK的输出

3) 记录触发发送第一条消息前的时间,获取EventHubClient建立连接的日志。计算耗时时间

4) 根据测试中输出的日志,得出5点结论

1:在2021-03-23 15:17:37.505时候,Connection连接建立成功,由于线程睡眠,所以在2021-03-23 15:18:37.463  (60秒后)Connection关闭,理由是( errorDescription[The connection was inactive for more than the allowed 60000 milliseconds and is closed by container 'LinkTracker')

2021-03-23 15:17:37.505  INFO 104016 --- [pool-1-thread-1] c.m.a.eventhubs.impl.ConnectionHandler   : onConnectionRemoteOpen: hostname[lbtesteh.servicebus.chinacloudapi.cn:5671], remoteContainer[cc19381675a649259fafb0c0d7faebe0_G18]
2021-03-23T07:17:37.538384400Z: Start to sleep ... waiting the connection idle timeout
2021-03-23 15:18:37.463 INFO 104016 --- [pool-1-thread-1] c.m.a.eventhubs.impl.ConnectionHandler : onConnectionRemoteClose: hostname[lbtesteh.servicebus.chinacloudapi.cn:5671], errorCondition[amqp:connection:forced], errorDescription[The connection was inactive for more than the allowed 60000 milliseconds and is closed by container 'LinkTracker'. TrackingId:cc19381675a649259fafb0c0d7faebe0_G18, SystemTracker:gateway7, Timestamp:2021-03-23T07:18:37]

2:当线程睡眠结束,在2021-03-23T15:18:42.559930300开始发送消息

3:EventHubClient马上开始重新创建 Connection, Session,Link。耗时近2秒(从2021-03-23 15:18:42.578到2021-03-23 15:18:44.592)

4:重建连接后第一条消息发送成功在2021-03-23T15:18:44.829493900

2021-03-23T07:18:42.538152400Z: End to sleep ...
Start: Send message 0 !2021-03-23T15:18:42.559930300
2021-03-23 15:18:42.578 INFO 104016 --- [pool-1-thread-1] c.m.azure.eventhubs.impl.MessageSender : clientId[EventHubClientImplb2e9d6-InternalSender], path[receivemessage], operationTimeout[PT1M30S], creating a send link
2021-03-23 15:18:42.606 INFO 104016 --- [pool-1-thread-1] c.m.a.eventhubs.impl.ConnectionHandler : onConnectionInit hostname[lbtesteh.servicebus.chinacloudapi.cn]
2021-03-23 15:18:42.607 INFO 104016 --- [pool-1-thread-1] c.m.azure.eventhubs.impl.SessionHandler : onSessionLocalOpen entityName[cbs-session], condition[Error{condition=null, description='null', info=null}]
2021-03-23 15:18:42.608 INFO 104016 --- [pool-1-thread-1] c.m.a.eventhubs.impl.SendLinkHandler : onLinkLocalOpen linkName[cbs:sender], localTarget[Target{address='$cbs', durable=NONE, expiryPolicy=SESSION_END, timeout=0, dynamic=false, dynamicNodeProperties=null, capabilities=null}]
2021-03-23 15:18:42.609 INFO 104016 --- [pool-1-thread-1] c.m.a.eventhubs.impl.ReceiveLinkHandler : onLinkLocalOpen linkName[cbs:receiver], localSource[Source{address='$cbs', durable=NONE, expiryPolicy=SESSION_END, timeout=0, dynamic=false, dynamicNodeProperties=null, distributionMode=null, filter=null, defaultOutcome=null, outcomes=null, capabilities=null}]
2021-03-23 15:18:42.609 INFO 104016 --- [pool-1-thread-1] c.m.a.eventhubs.impl.ConnectionHandler : onConnectionLocalOpen: hostname[lbtesteh.servicebus.chinacloudapi.cn:5671], errorCondition[null], errorDescription[null]
2021-03-23 15:18:42.610 INFO 104016 --- [pool-1-thread-1] c.m.a.eventhubs.impl.ConnectionHandler : onConnectionBound hostname[lbtesteh.servicebus.chinacloudapi.cn]
2021-03-23 15:18:43.830 INFO 104016 --- [pool-1-thread-1] c.m.a.eventhubs.impl.ConnectionHandler : onConnectionRemoteOpen: hostname[lbtesteh.servicebus.chinacloudapi.cn:5671], remoteContainer[79f3573f29a44a1296940126b03be077_G20]
2021-03-23 15:18:43.832 INFO 104016 --- [pool-1-thread-1] c.m.azure.eventhubs.impl.SessionHandler : onSessionRemoteOpen entityName[cbs-session], sessionIncCapacity[0], sessionOutgoingWindow[2147483647]
2021-03-23 15:18:43.833 INFO 104016 --- [pool-1-thread-1] c.m.a.eventhubs.impl.SendLinkHandler : onLinkRemoteOpen linkName[cbs:sender], remoteTarget[Target{address='$cbs', durable=NONE, expiryPolicy=SESSION_END, timeout=0, dynamic=false, dynamicNodeProperties=null, capabilities=null}]
2021-03-23 15:18:43.835 INFO 104016 --- [pool-1-thread-1] c.m.a.eventhubs.impl.ReceiveLinkHandler : onLinkRemoteOpen linkName[cbs:receiver], remoteSource[Source{address='$cbs', durable=NONE, expiryPolicy=SESSION_END, timeout=0, dynamic=false, dynamicNodeProperties=null, distributionMode=null, filter=null, defaultOutcome=null, outcomes=null, capabilities=null}]
2021-03-23 15:18:44.265 INFO 104016 --- [pool-1-thread-1] c.m.azure.eventhubs.impl.SessionHandler : onSessionLocalOpen entityName[receivemessage], condition[Error{condition=null, description='null', info=null}]
2021-03-23 15:18:44.420 INFO 104016 --- [pool-1-thread-1] c.m.azure.eventhubs.impl.SessionHandler : onSessionRemoteOpen entityName[receivemessage], sessionIncCapacity[0], sessionOutgoingWindow[2147483647]
2021-03-23 15:18:44.421 INFO 104016 --- [pool-1-thread-1] c.m.a.eventhubs.impl.SendLinkHandler : onLinkLocalOpen linkName[37adea_077_G20_1616483924421], localTarget[Target{address='receivemessage', durable=NONE, expiryPolicy=SESSION_END, timeout=0, dynamic=false, dynamicNodeProperties=null, capabilities=null}]
2021-03-23 15:18:44.590 INFO 104016 --- [pool-1-thread-1] c.m.a.eventhubs.impl.SendLinkHandler : onLinkRemoteOpen linkName[37adea_077_G20_1616483924421], remoteTarget[Target{address='receivemessage', durable=NONE, expiryPolicy=SESSION_END, timeout=0, dynamic=false, dynamicNodeProperties=null, capabilities=null}]
2021-03-23 15:18:44.592 INFO 104016 --- [pool-1-thread-1] c.m.azure.eventhubs.impl.MessageSender : onOpenComplete - clientId[EventHubClientImplb2e9d6-InternalSender], sendPath[receivemessage], linkName[37adea_077_G20_1616483924421]
Completed: Send message 0 !2021-03-23T15:18:44.829493900

5:第二条,第N条发送的时间就非常的短暂,在300毫秒左右。

Completed: Send message 0 !2021-03-23T15:18:44.829493900
Start: Send message 1 !2021-03-23T15:18:44.830505
Completed: Send message 1 !2021-03-23T15:18:45.035403600
Start: Send message 2 !2021-03-23T15:18:45.035403600
Completed: Send message 2 !2021-03-23T15:18:45.249423400
Start: Send message 3 !2021-03-23T15:18:45.250395800
Completed: Send message 3 !2021-03-23T15:18:45.468455300
Start: Send message 4 !2021-03-23T15:18:45.470397200
Completed: Send message 4 !2021-03-23T15:18:45.769922900
Start: Send message 5 !2021-03-23T15:18:45.770920300
Completed: Send message 5 !2021-03-23T15:18:45.973769300
Start: Send message 6 !2021-03-23T15:18:45.975713700
Completed: Send message 6 !2021-03-23T15:18:46.168880300
Start: Send message 7 !2021-03-23T15:18:46.169844900
Completed: Send message 7 !2021-03-23T15:18:46.377778800

总结:EventHub Client在创建过程中的三个关键因素和日志中所打印出的事件顺序

EventHub Client使用AMQP协议的连接创建与关闭的过程:  它涉及到三个主要的部分:connection,sessionlink

三者关系图

创建连接全过程事件顺序

关闭连接全过程事件顺序

代码

  • pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.4.4</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.example</groupId>
<artifactId>sendehmsg</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>sendehmsg</name>
<description>Demo project for Spring Boot</description>
<properties>
<java.version>11</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency> <dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency> <dependency>
<groupId>com.microsoft.azure</groupId>
<artifactId>azure-eventhubs</artifactId>
<version>2.2.0</version>
</dependency> </dependencies> <build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build> </project>
  • SendehmsgApplication.java

package com.example.sendehmsg;

import com.microsoft.azure.eventhubs.ConnectionStringBuilder;
import com.microsoft.azure.eventhubs.EventData;
import com.microsoft.azure.eventhubs.EventHubClient;
import com.microsoft.azure.eventhubs.EventHubException; import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.nio.charset.Charset;
import java.sql.Date;
import java.sql.Time;
import java.time.Duration;
import java.time.Instant;
import java.time.LocalDateTime;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication
public class SendehmsgApplication { public static void main(String[] args)
throws EventHubException, IOException, InterruptedException, URISyntaxException {
SpringApplication.run(SendehmsgApplication.class, args); final ConnectionStringBuilder connStr = new ConnectionStringBuilder().setNamespaceName("xxxxxxxxxxxxxx")
.setEndpoint(new URI("sb://xxxxxxxxxxxxxx.servicebus.chinacloudapi.cn/")).setEventHubName("receivemessage")
.setSasKeyName("all").setSasKey("xxxxxxxxxxxxxx")
.setOperationTimeout(Duration.ofSeconds(90)); // The Executor handles all asynchronous tasks and this is passed to the
// EventHubClient instance.
// This enables the user to segregate their thread pool based on the work load.
// This pool can then be shared across multiple EventHubClient instances.
// The following sample uses a single thread executor, as there is only one
// EventHubClient instance,
// handling different flavors of ingestion to Event Hubs here.
final ScheduledExecutorService executorService = Executors.newScheduledThreadPool(1); // Each EventHubClient instance spins up a new TCP/TLS connection, which is
// expensive.
// It is always a best practice to reuse these instances. The following sample
// shows this.
// final EventHubClient ehClient = EventHubClient.createSync(connectionstr,
// executorService);
final EventHubClient ehClient = EventHubClient.createSync(connStr.toString(), executorService); // Send the First message
EventData sendEvent = EventData.create("Message 0".getBytes());
System.out.println("Start: Send message 0 !" + LocalDateTime.now().toString());
ehClient.sendSync(sendEvent);
System.out.println("Completed: Send message 0 !" + LocalDateTime.now().toString()); try {
for (int i = 1; i < 100; i++) {
var timelong = 10000;
System.out.println("@@@@@@@@@@@@@@@@" + LocalDateTime.now().toString() + ": [" + i
+ "] Start to sleep ... waiting the connection idle timeout");
for (int j = 0; j < i*30; j++) {
Thread.sleep(timelong);
}
System.out.println("@@@@@@@@@@@@@@@@" + LocalDateTime.now().toString() + ": [" + i
+ "] End to sleep ..." + timelong);
String payload = "Message " + Integer.toString(i);
// byte[] payloadBytes =
// gson.toJson(payload).getBytes(Charset.defaultCharset());
sendEvent = EventData.create(payload.getBytes()); // Send - not tied to any partition
// Event Hubs service will round-robin the events across all Event Hubs
// partitions.
// This is the recommended & most reliable way to send to Event Hubs. System.out.println("Start: Send message " + i + " !" + LocalDateTime.now().toString()); ehClient.sendSync(sendEvent); System.out.println("Completed: Send message " + i + " !" + LocalDateTime.now().toString());
} System.out.println(Instant.now() + ": Send Complete...");
System.out.println("Press Enter to stop."); // System.in.read();
} finally {
ehClient.closeSync();
executorService.shutdown();
} } }

日志

PS C:\LBWorkSpace\MyCode\22-EventHub- send message - Java\sendehmsg>  c:; cd 'c:\LBWorkSpace\MyCode\22-EventHub- send message - Java\sendehmsg'; & 'c:\Users\bulu\.vscode\extensions\vscjava.vscode-java-debug-0.32.0\scripts\launcher.bat' 'C:\Program Files\Java\jdk-12.0.1\bin\java.exe' '-Dfile.encoding=UTF-8' '@C:\Users\bulu\AppData\Local\Temp\cp_9a7ev5x7qjbbggrbbozjir273.argfile' 'com.example.sendehmsg.SendehmsgApplication' 

  .   ____          _            __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.4.4) 2021-03-23 15:17:33.414 INFO 104016 --- [ main] c.e.sendehmsg.SendehmsgApplication : Starting SendehmsgApplication using Java 12.0.1 on MININT-S4MGVOU with PID 104016 (C:\LBWorkSpace\MyCode\22-EventHub- send message - Java\sendehmsg\target\classes started by bulu in C:\LBWorkSpace\MyCode\22-EventHub- send message - Java\sendehmsg)
2021-03-23 15:17:33.419 INFO 104016 --- [ main] c.e.sendehmsg.SendehmsgApplication : No active profile set, falling back to default profiles: default
2021-03-23 15:17:35.292 INFO 104016 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http)
2021-03-23 15:17:35.305 INFO 104016 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2021-03-23 15:17:35.305 INFO 104016 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.44]
2021-03-23 15:17:35.436 INFO 104016 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2021-03-23 15:17:35.436 INFO 104016 --- [ main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 1936 ms
2021-03-23 15:17:35.655 INFO 104016 --- [ main] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'applicationTaskExecutor'
2021-03-23 15:17:35.866 INFO 104016 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8080 (http) with context path ''
2021-03-23 15:17:35.878 INFO 104016 --- [ main] c.e.sendehmsg.SendehmsgApplication : Started SendehmsgApplication in 3.076 seconds (JVM running for 3.633)
2021-03-23 15:17:35.926 INFO 104016 --- [pool-1-thread-1] c.m.a.eventhubs.impl.MessagingFactory : messagingFactory[MessagingFactorye40067], hostName[lbtesteh.servicebus.chinacloudapi.cn], info[starting reactor instance.]
2021-03-23 15:17:35.935 INFO 104016 --- [pool-1-thread-1] c.m.azure.eventhubs.impl.ReactorHandler : reactor.onReactorInit
2021-03-23 15:17:35.942 INFO 104016 --- [pool-1-thread-1] c.m.a.eventhubs.impl.ConnectionHandler : onConnectionInit hostname[lbtesteh.servicebus.chinacloudapi.cn]
2021-03-23 15:17:35.945 INFO 104016 --- [pool-1-thread-1] c.m.a.eventhubs.impl.ConnectionHandler : onConnectionLocalOpen: hostname[lbtesteh.servicebus.chinacloudapi.cn:5671], errorCondition[null], errorDescription[null]
2021-03-23 15:17:36.086 INFO 104016 --- [pool-1-thread-1] c.m.a.eventhubs.impl.ConnectionHandler : onConnectionBound hostname[lbtesteh.servicebus.chinacloudapi.cn]
2021-03-23 15:17:37.505 INFO 104016 --- [pool-1-thread-1] c.m.a.eventhubs.impl.ConnectionHandler : onConnectionRemoteOpen: hostname[lbtesteh.servicebus.chinacloudapi.cn:5671], remoteContainer[cc19381675a649259fafb0c0d7faebe0_G18]
2021-03-23T07:17:37.538384400Z: Start to sleep ... waiting the connection idle timeout
2021-03-23 15:18:37.463 INFO 104016 --- [pool-1-thread-1] c.m.a.eventhubs.impl.ConnectionHandler : onConnectionRemoteClose: hostname[lbtesteh.servicebus.chinacloudapi.cn:5671], errorCondition[amqp:connection:forced], errorDescription[The connection was inactive for more than the allowed 60000 milliseconds and is closed by container 'LinkTracker'. TrackingId:cc19381675a649259fafb0c0d7faebe0_G18, SystemTracker:gateway7, Timestamp:2021-03-23T07:18:37]
2021-03-23 15:18:37.465 WARN 104016 --- [pool-1-thread-1] c.m.a.eventhubs.impl.MessagingFactory : onConnectionError: messagingFactory[MessagingFactorye40067], hostname[lbtesteh.servicebus.chinacloudapi.cn], error[The connection was inactive for more than the allowed 60000 milliseconds and is closed by container 'LinkTracker'. TrackingId:cc19381675a649259fafb0c0d7faebe0_G18, SystemTracker:gateway7, Timestamp:2021-03-23T07:18:37]
2021-03-23 15:18:37.466 WARN 104016 --- [pool-1-thread-1] c.m.a.eventhubs.impl.MessagingFactory : onConnectionError: messagingFactory[MessagingFactorye40067], hostname[lbtesteh.servicebus.chinacloudapi.cn], closing current
connection
2021-03-23 15:18:37.468 INFO 104016 --- [pool-1-thread-1] c.m.a.eventhubs.impl.ConnectionHandler : onConnectionLocalClose: hostname[lbtesteh.servicebus.chinacloudapi.cn:5671], errorCondition[amqp:connection:forced], errorDescription[The connection was inactive for more than the allowed 60000 milliseconds and is closed by container 'LinkTracker'. TrackingId:cc19381675a649259fafb0c0d7faebe0_G18, SystemTracker:gateway7, Timestamp:2021-03-23T07:18:37]2021-03-23 15:18:37.470 INFO 104016 --- [pool-1-thread-1] c.m.a.eventhubs.impl.ConnectionHandler : onConnectionUnbound: hostname[lbtesteh.servicebus.chinacloudapi.cn:5671], state[CLOSED], remoteState[CLOSED]
2021-03-23 15:18:37.472 INFO 104016 --- [pool-1-thread-1] c.m.a.eventhubs.impl.ConnectionHandler : onConnectionFinal: hostname[lbtesteh.servicebus.chinacloudapi.cn:5671], errorCondition[amqp:connection:forced], errorDescription[The connection was inactive for more than the allowed 60000 milliseconds and is closed by container 'LinkTracker'. TrackingId:cc19381675a649259fafb0c0d7faebe0_G18, SystemTracker:gateway7, Timestamp:2021-03-23T07:18:37]
2021-03-23T07:18:42.538152400Z: End to sleep ...
Start: Send message 0 !2021-03-23T15:18:42.559930300
2021-03-23 15:18:42.578 INFO 104016 --- [pool-1-thread-1] c.m.azure.eventhubs.impl.MessageSender : clientId[EventHubClientImplb2e9d6-InternalSender], path[receivemessage], operationTimeout[PT1M30S], creating a send link
2021-03-23 15:18:42.606 INFO 104016 --- [pool-1-thread-1] c.m.a.eventhubs.impl.ConnectionHandler : onConnectionInit hostname[lbtesteh.servicebus.chinacloudapi.cn]
2021-03-23 15:18:42.607 INFO 104016 --- [pool-1-thread-1] c.m.azure.eventhubs.impl.SessionHandler : onSessionLocalOpen entityName[cbs-session], condition[Error{condition=null, description='null', info=null}]
2021-03-23 15:18:42.608 INFO 104016 --- [pool-1-thread-1] c.m.a.eventhubs.impl.SendLinkHandler : onLinkLocalOpen linkName[cbs:sender], localTarget[Target{address='$cbs', durable=NONE, expiryPolicy=SESSION_END, timeout=0, dynamic=false, dynamicNodeProperties=null, capabilities=null}]
2021-03-23 15:18:42.609 INFO 104016 --- [pool-1-thread-1] c.m.a.eventhubs.impl.ReceiveLinkHandler : onLinkLocalOpen linkName[cbs:receiver], localSource[Source{address='$cbs', durable=NONE, expiryPolicy=SESSION_END, timeout=0, dynamic=false, dynamicNodeProperties=null, distributionMode=null, filter=null, defaultOutcome=null, outcomes=null, capabilities=null}]
2021-03-23 15:18:42.609 INFO 104016 --- [pool-1-thread-1] c.m.a.eventhubs.impl.ConnectionHandler : onConnectionLocalOpen: hostname[lbtesteh.servicebus.chinacloudapi.cn:5671], errorCondition[null], errorDescription[null]
2021-03-23 15:18:42.610 INFO 104016 --- [pool-1-thread-1] c.m.a.eventhubs.impl.ConnectionHandler : onConnectionBound hostname[lbtesteh.servicebus.chinacloudapi.cn]
2021-03-23 15:18:43.830 INFO 104016 --- [pool-1-thread-1] c.m.a.eventhubs.impl.ConnectionHandler : onConnectionRemoteOpen: hostname[lbtesteh.servicebus.chinacloudapi.cn:5671], remoteContainer[79f3573f29a44a1296940126b03be077_G20]
2021-03-23 15:18:43.832 INFO 104016 --- [pool-1-thread-1] c.m.azure.eventhubs.impl.SessionHandler : onSessionRemoteOpen entityName[cbs-session], sessionIncCapacity[0], sessionOutgoingWindow[2147483647]
2021-03-23 15:18:43.833 INFO 104016 --- [pool-1-thread-1] c.m.a.eventhubs.impl.SendLinkHandler : onLinkRemoteOpen linkName[cbs:sender], remoteTarget[Target{address='$cbs', durable=NONE, expiryPolicy=SESSION_END, timeout=0, dynamic=false, dynamicNodeProperties=null, capabilities=null}]
2021-03-23 15:18:43.835 INFO 104016 --- [pool-1-thread-1] c.m.a.eventhubs.impl.ReceiveLinkHandler : onLinkRemoteOpen linkName[cbs:receiver], remoteSource[Source{address='$cbs', durable=NONE, expiryPolicy=SESSION_END, timeout=0, dynamic=false, dynamicNodeProperties=null, distributionMode=null, filter=null, defaultOutcome=null, outcomes=null, capabilities=null}]
2021-03-23 15:18:44.265 INFO 104016 --- [pool-1-thread-1] c.m.azure.eventhubs.impl.SessionHandler : onSessionLocalOpen entityName[receivemessage], condition[Error{condition=null, description='null', info=null}]
2021-03-23 15:18:44.420 INFO 104016 --- [pool-1-thread-1] c.m.azure.eventhubs.impl.SessionHandler : onSessionRemoteOpen entityName[receivemessage], sessionIncCapacity[0], sessionOutgoingWindow[2147483647]
2021-03-23 15:18:44.421 INFO 104016 --- [pool-1-thread-1] c.m.a.eventhubs.impl.SendLinkHandler : onLinkLocalOpen linkName[37adea_077_G20_1616483924421], localTarget[Target{address='receivemessage', durable=NONE, expiryPolicy=SESSION_END, timeout=0, dynamic=false, dynamicNodeProperties=null, capabilities=null}]
2021-03-23 15:18:44.590 INFO 104016 --- [pool-1-thread-1] c.m.a.eventhubs.impl.SendLinkHandler : onLinkRemoteOpen linkName[37adea_077_G20_1616483924421], remoteTarget[Target{address='receivemessage', durable=NONE, expiryPolicy=SESSION_END, timeout=0, dynamic=false, dynamicNodeProperties=null, capabilities=null}]
2021-03-23 15:18:44.592 INFO 104016 --- [pool-1-thread-1] c.m.azure.eventhubs.impl.MessageSender : onOpenComplete - clientId[EventHubClientImplb2e9d6-InternalSender], sendPath[receivemessage], linkName[37adea_077_G20_1616483924421]
Completed: Send message 0 !2021-03-23T15:18:44.829493900
Start: Send message 1 !2021-03-23T15:18:44.830505
Completed: Send message 1 !2021-03-23T15:18:45.035403600
Start: Send message 2 !2021-03-23T15:18:45.035403600
Completed: Send message 2 !2021-03-23T15:18:45.249423400
Start: Send message 3 !2021-03-23T15:18:45.250395800
Completed: Send message 3 !2021-03-23T15:18:45.468455300
Start: Send message 4 !2021-03-23T15:18:45.470397200
Completed: Send message 4 !2021-03-23T15:18:45.769922900
Start: Send message 5 !2021-03-23T15:18:45.770920300
Completed: Send message 5 !2021-03-23T15:18:45.973769300
Start: Send message 6 !2021-03-23T15:18:45.975713700
Completed: Send message 6 !2021-03-23T15:18:46.168880300
Start: Send message 7 !2021-03-23T15:18:46.169844900
Completed: Send message 7 !2021-03-23T15:18:46.377778800
Start: Send message 8 !2021-03-23T15:18:46.379782200
Completed: Send message 8 !2021-03-23T15:18:46.601331
Start: Send message 9 !2021-03-23T15:18:46.603331700
Completed: Send message 9 !2021-03-23T15:18:46.804803400
2021-03-23T07:18:46.805802600Z: Send Complete...
Press Enter to stop.
2021-03-23 15:18:46.807 INFO 104016 --- [ main] c.m.azure.eventhubs.impl.ClientEntity : close: clientId[EventHubClientImplb2e9d6]
2021-03-23 15:18:46.808 INFO 104016 --- [ main] c.m.azure.eventhubs.impl.ClientEntity : close: clientId[EventHubClientImplb2e9d6-InternalSender]
2021-03-23 15:18:46.821 INFO 104016 --- [pool-1-thread-1] c.m.a.eventhubs.impl.BaseLinkHandler : onLinkLocalClose linkName[37adea_077_G20_1616483924421], errorCondition[null], errorDescription[null]
2021-03-23 15:18:46.822 INFO 104016 --- [pool-1-thread-1] c.m.a.eventhubs.impl.BaseLinkHandler : closeSession for linkName[37adea_077_G20_1616483924421], errorCondition[null], errorDescription[null]
2021-03-23 15:18:46.826 INFO 104016 --- [pool-1-thread-1] c.m.azure.eventhubs.impl.SessionHandler : onSessionLocalClose entityName[receivemessage], condition[Error{condition=null, description='null', info=null}]
2021-03-23 15:18:47.059 INFO 104016 --- [pool-1-thread-1] c.m.a.eventhubs.impl.BaseLinkHandler : onLinkRemoteClose linkName[37adea_077_G20_1616483924421], errorCondition[null], errorDescription[null]
2021-03-23 15:18:47.061 INFO 104016 --- [pool-1-thread-1] c.m.a.eventhubs.impl.BaseLinkHandler : processOnClose linkName[37adea_077_G20_1616483924421], errorCondition[null], errorDescription[null]
2021-03-23 15:18:47.063 INFO 104016 --- [pool-1-thread-1] c.m.azure.eventhubs.impl.SessionHandler : onSessionRemoteClose entityName[receivemessage], condition[Error{condition=null, description='null', info=null}]
2021-03-23 15:18:47.093 INFO 104016 --- [pool-1-thread-1] c.m.azure.eventhubs.impl.ClientEntity : close: clientId[MessagingFactorye40067]
2021-03-23 15:18:47.100 INFO 104016 --- [pool-1-thread-1] c.m.a.eventhubs.impl.ConnectionHandler : onConnectionLocalClose: hostname[lbtesteh.servicebus.chinacloudapi.cn:5671], errorCondition[null], errorDescription[null]
2021-03-23 15:18:47.102 INFO 104016 --- [pool-1-thread-1] c.m.a.eventhubs.impl.BaseLinkHandler : onLinkLocalClose linkName[cbs:sender], errorCondition[null], errorDescription[null]
2021-03-23 15:18:47.103 INFO 104016 --- [pool-1-thread-1] c.m.a.eventhubs.impl.BaseLinkHandler : closeSession for linkName[cbs:sender], errorCondition[null], errorDescription[null]
2021-03-23 15:18:47.103 INFO 104016 --- [pool-1-thread-1] c.m.a.eventhubs.impl.BaseLinkHandler : onLinkLocalClose linkName[cbs:receiver], errorCondition[null], errorDescription[null]
2021-03-23 15:18:47.104 INFO 104016 --- [pool-1-thread-1] c.m.azure.eventhubs.impl.SessionHandler : onSessionLocalClose entityName[cbs-session], condition[Error{condition=null, description='null', info=null}]
2021-03-23 15:18:47.422 INFO 104016 --- [pool-1-thread-1] c.m.a.eventhubs.impl.BaseLinkHandler : onLinkRemoteClose linkName[cbs:sender], errorCondition[null], errorDescription[null]
2021-03-23 15:18:47.423 INFO 104016 --- [pool-1-thread-1] c.m.a.eventhubs.impl.BaseLinkHandler : processOnClose linkName[cbs:sender], errorCondition[null], errorDescription[null]
2021-03-23 15:18:47.424 INFO 104016 --- [pool-1-thread-1] c.m.a.eventhubs.impl.BaseLinkHandler : onLinkRemoteClose linkName[cbs:receiver], errorCondition[null], errorDescription[null]
2021-03-23 15:18:47.424 INFO 104016 --- [pool-1-thread-1] c.m.a.eventhubs.impl.BaseLinkHandler : processOnClose linkName[cbs:receiver], errorCondition[null], errorDescription[null]
2021-03-23 15:18:47.425 INFO 104016 --- [pool-1-thread-1] c.m.a.eventhubs.impl.MessagingFactory : messagingFactory[MessagingFactorye40067], hostName[lbtesteh.servicebus.chinacloudapi.cn], info[cbsChannel closed]
2021-03-23 15:18:47.426 INFO 104016 --- [pool-1-thread-1] c.m.a.eventhubs.impl.ConnectionHandler : onConnectionRemoteClose: hostname[lbtesteh.servicebus.chinacloudapi.cn:5671], errorCondition[null], errorDescription[null]
2021-03-23 15:18:47.427 WARN 104016 --- [pool-1-thread-1] c.m.a.eventhubs.impl.MessagingFactory : onConnectionError: messagingFactory[MessagingFactorye40067], hostname[lbtesteh.servicebus.chinacloudapi.cn], error[null]
2021-03-23 15:18:47.428 INFO 104016 --- [pool-1-thread-1] c.m.a.eventhubs.impl.ConnectionHandler : onTransportClosed: hostname[lbtesteh.servicebus.chinacloudapi.cn:5671], error[n/a]
2021-03-23 15:18:47.429 INFO 104016 --- [pool-1-thread-1] c.m.a.eventhubs.impl.CustomIOHandler : onTransportClosed hostname[lbtesteh.servicebus.chinacloudapi.cn:5671]
2021-03-23 15:18:47.429 INFO 104016 --- [pool-1-thread-1] c.m.a.eventhubs.impl.ConnectionHandler : onConnectionUnbound: hostname[lbtesteh.servicebus.chinacloudapi.cn:5671], state[CLOSED], remoteState[CLOSED]
2021-03-23 15:18:47.430 INFO 104016 --- [pool-1-thread-1] c.m.azure.eventhubs.impl.SessionHandler : onSessionFinal entityName[cbs-session], condition[null], description[null]
2021-03-23 15:18:47.431 INFO 104016 --- [pool-1-thread-1] c.m.azure.eventhubs.impl.SessionHandler : onSessionFinal entityName[receivemessage], condition[null], description[null]
2021-03-23 15:18:47.431 INFO 104016 --- [pool-1-thread-1] c.m.a.eventhubs.impl.ConnectionHandler : onConnectionFinal: hostname[lbtesteh.servicebus.chinacloudapi.cn:5671], errorCondition[null], errorDescription[null]
2021-03-23 15:18:47.432 WARN 104016 --- [pool-1-thread-1] c.m.a.eventhubs.impl.MessagingFactory : messagingFactory[MessagingFactorye40067], hostName[lbtesteh.servicebus.chinacloudapi.cn], message[stopping the reactor because thread was interrupted or the reactor has no more events to process.]

参考资料

Azure 服务总线和事件中心内的 AMQP 1.0 协议指南:https://docs.azure.cn/zh-cn/service-bus-messaging/service-bus-amqp-protocol-guide?toc=https%3A%2F%2Fdocs.azure.cn%2Fzh-cn%2Fevent-hubs%2Ftoc.json&bc=https%3A%2F%2Fdocs.azure.cn%2Fzh-cn%2Fbread%2Ftoc.json#what-is-amqp

【Azure 事件中心】Event Hub Client 连接超时(OperationTimeout)测试及解说的更多相关文章

  1. 【Azure 事件中心】在微软云中国区 (Mooncake) 上实验以Apache Kafka协议方式发送/接受Event Hubs消息 (Java版)

    问题描述 事件中心提供 Kafka 终结点,现有的基于 Kafka 的应用程序可将该终结点用作运行你自己的 Kafka 群集的替代方案. 事件中心可与许多现有 Kafka 应用程序配合使用.在Azur ...

  2. 【Azure 事件中心】使用Azure AD认证方式创建Event Hub Consume Client + 自定义Event Position

    问题描述 当使用SDK连接到Azure Event Hub时,最常规的方式为使用连接字符串.这种做法参考官网文档就可成功完成代码:https://docs.azure.cn/zh-cn/event-h ...

  3. 【Azure 事件中心】Event Hub 无法连接,出现 Did not observe any item or terminal signal within 60000ms in 'flatMapMany' 的错误消息

    问题描述 使用Java SDK连接Azure Event Hub,一直出现 java.util.concurrent.TimeoutException 异常, 消息为:java.util.concur ...

  4. 【Azure 事件中心】Azure Event Hub 新功能尝试 -- 异地灾难恢复 (Geo-Disaster Recovery)

    问题描述 关于Event Hub(事件中心)的灾备方案,大多数就是新建另外一个备用的Event Hub,当主Event Hub出现不可用的情况时,就需要切换到备Event Hub上. 而在切换的过程中 ...

  5. 【Azure 事件中心】 org.slf4j.Logger 收集 Event Hub SDK(Java) 输出日志并以文件形式保存

    问题描述 在使用Azure Event Hub的SDK时候,常规情况下,发现示例代码中并没有SDK内部的日志输出.因为在Java项目中,没有添加 SLF4J 依赖,已致于在启动时候有如下提示: SLF ...

  6. 【Azure 事件中心】为应用程序网关(Application Gateway with WAF) 配置诊断日志,发送到事件中心

    问题描述 在Application Gateway中,开启WAF(Web application firewall)后,现在需要把访问的日志输出到第三方分析代码中进行分析,如何来获取WAF的诊断日志呢 ...

  7. 【Azure 事件中心】EPH (EventProcessorHost) 消费端观察到多次Shutdown,LeaseLost的error信息,这是什么情况呢?

    问题详情 使用EPH获取Event Hub数据时,多次出现连接shutdown和LeaseLost的error  ,截取某一次的error log如: Time:2021-03-10 08:43:48 ...

  8. Azure Event Hub 技术研究系列2-发送事件到Event Hub

    上篇博文中,我们介绍了Azure Event Hub的一些基本概念和架构: Azure Event Hub 技术研究系列1-Event Hub入门篇 本篇文章中,我们继续深入研究,了解Azure Ev ...

  9. 【Azure 事件中心】在Service Bus Explorer工具种查看到EventHub数据在分区中的各种属性问题

    问题描述 通过Service Bus Explorer工具,查看到Event Hub的属性值,从而产生的问题及讨论: Size in Bytes:   这个是表示当前分区可以存储的最大字节数吗? La ...

  10. 【Azure 事件中心】azure-spring-cloud-stream-binder-eventhubs客户端组件问题, 实践消息非顺序可达

    问题描述 查阅了Azure的官方文档( 将事件发送到特定分区: https://docs.azure.cn/zh-cn/event-hubs/event-hubs-availability-and-c ...

随机推荐

  1. UOS 以及 部分NetworkManager管理linux服务器 设置固定IP地址的办法.

    UOS 以及 部分NetworkManager管理linux服务器 设置固定IP地址的办法. 很多操作系统没法右键 网络连接进行处理 但是发现大部分机器都增加了 NetworkManager 的网络管 ...

  2. vscode中快速声明数据类型

    如何快速声明数据类型 上面这张图 let obj1= reactive({ listArr: [], backArr: [{name:'张三',age:10, info:'本科'}], age: 10 ...

  3. Vue.use和install之间的关系

    创建一个plugins.js文件 跟main.js同级下,创建一个plugins.js文件 export default { // install是vue给我们提供的.它会自动去执行install. ...

  4. Redux和@reduxjs/toolkit的使用

    1. 简介: Redux 是一种用于管理应用程序状态的 JavaScript 库.它是一个可预测的状态容器,可以用于编写 可维护和可扩展的应用程序. @reduxjs/toolkit 是一个官方提供的 ...

  5. 紫 distance

    仅此纪念我爆掉的T3 紫,即RE,运行出错,梦幻,而又不失杀气 根据<雪distance>改编,分为提交前,评测前,评测时,评测后 你说我考试AK,可我却运行出错 任凭无尽的懊悔将我淹没, ...

  6. 复原docker中容器的启动命令

    复原 docker 容器的启动命令 前言 查看 docker 容器的启动命令 参考 复原 docker 容器的启动命令 前言 不规范的操作,在启动 docker 容器,没有留命令脚本,或者没有使用 d ...

  7. 利用Mybatis拦截器实现自定义的ID自增器

    原生的Mybatis框架是没有ID自增器,但例如国产的Mybatis Plus却是支持,不过,Mybatis Plus却是缺少了自定属性的填充:例如:我们需要自定义填充一些属性,updateDate. ...

  8. 使用JAAS文件登陆kerberos(zookeeper)

    Kerberos 5 Configuration Since the SPNEGO mechanism will call JGSS, which in turns calls the Kerbero ...

  9. Docker从认识到实践再到底层原理(三)|Docker在Centos7环境下的安装和配置

    前言 那么这里博主先安利一些干货满满的专栏了! 首先是博主的高质量博客的汇总,这个专栏里面的博客,都是博主最最用心写的一部分,干货满满,希望对大家有帮助. 高质量博客汇总 然后就是博主最近最花时间的一 ...

  10. 【双指针】双指针算法详解两道经典OJ【力扣27,力扣26,力扣38】超详细算法教程

    [双指针]双指针算法详解两道经典OJ[力扣27,力扣26,力扣38]超详细算法教程 今天又又到了我们刷力扣题的时间啦! 今天博主给大家带来的三道题是: 27. 移除元素 26. 删除有序数组中的重复项 ...