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. 除了Adobe之外,还有什么方法可以将Excel转为PDF?

    前言 Java是一种广泛使用的编程语言,它在企业级应用开发中发挥着重要作用.而在实际的开发过程中,我们常常需要处理各种数据格式转换的需求.今天小编为大家介绍下如何使用葡萄城公司的的Java API 组 ...

  2. 谈谈Java中的反射机制

    前言 在使用框架进行开发时,我们的开发速度大大提升.我们感叹于它的神奇之处,我们使用它的时候,也要知道其"灵魂".正所谓,无反射,不框架,框架的灵魂就是反射. 另外,我们在ecli ...

  3. 整个小东西,在IDEA中自动生成PO、DAO、Mapper

    作者:小傅哥 博客:https://bugstack.cn 源码:https://github.com/fuzhengwei/CodeGuide/wiki 沉淀.分享.成长,让自己和他人都能有所收获! ...

  4. centos7多网口配置同网段IP解决方案

    环境 CentOS Linux release 7.9.2009 (Core) 需求 服务器eth0和eth1配置同网段IP地址.掩码不配网关,同时连接两根网线,对端是两台物理隔离的交换机. 现象 给 ...

  5. DBGRIDEH 底部多列 发现

    1.设置底部行数 2.点击footers 单独对每一行进行设置 3.单独对这两行 进行设置 5.看下辅助 所以用的时候可以这样用:WeiTopTradeShow.FieldColumns['top_x ...

  6. MySQL8-[问题解决]java.sql.SQLNonTransientConnectionException: Cannot load connection class because of underlying

    对应为MySQL8和 MySQL-connecter8.0.16 1.修改MySQL驱动器 原来的版本: com.mysql.jdbc.Driver 现在改为:com.mysql.cj.jdbc.Dr ...

  7. Pandas字符串离散化处理

    字符串离散化处理 import pandas as pd import numpy as np from matplotlib import pyplot as plt # 读取csv文件 file_ ...

  8. Power BI 1 DAY

    目录 Power BI(商业智能)分析 BI 分析步骤 Power Query 表数据结构 区别 主键 Power Query中的纵向合并与横向合并 销售一表和销售二表进行纵向合并为一张销售表. 产品 ...

  9. JOISC 2023 纪录

    记录一下 JOISC 2023 的做题记录 Day1 T1 Two Currencies 给定一棵树,在边上有总计 \(m\) 个检查站,经过一个检查站需要叫 \(1\) 枚金币或者若干枚银币.\(Q ...

  10. NC50381 道路和航线

    题目链接 题目 题目描述 FarmerJohn正在一个新的销售区域对他的牛奶销售方案进行调查.他想把牛奶送到T个城镇,编号为1到T.这些城镇之间通过R条道路(编号为1到R)和P条航线(编号为1到P)连 ...