Я создаю приложение, которое использует события из всех разделов Azure концентратора событий. Я сталкиваюсь с проблемой более низкого уровня потребления. При запуске приложение получает высокую скорость загрузки и уменьшается со временем.
код, как показано в фрагментах пружинной загрузки
private Disposable subscription;
private EventHubConsumerAsyncClient client;
client = new EventHubClientBuilder()
.connectionString(ehProps.getConnectionString(), ehProps.getEventHubName())
.consumerGroup(ehProps.getStorage().getConsumerGroupName()).buildAsyncConsumerClient();
subscription = client.receive(true).subscribe(new EventProcessor());
Служба EventProcessor
@Service
public class EventProcessor implements Consumer<PartitionEvent> {
long start = System.currentTimeMillis();
int count = 0;
int total = 0;
@Override
public void accept(PartitionEvent event) {
if (System.currentTimeMillis() - start < 1000) {
count++;
} else {
System.out.println("Events per second ::" + count);
count = 0;
start = System.currentTimeMillis();
}
}
}
Colsole o / p
2020-04-30 19:50:11.024 INFO 6906 --- [ single-1] c.a.m.e.EventHubConsumerAsyncClient : connectionId[MF_dcd848_1588256404924] linkName[all_fd160b_1588256404998-2]: Creating receive consumer for partition '2'
2020-04-30 19:50:11.024 INFO 6906 --- [ single-1] c.a.c.a.implementation.ReactorSession : linkName[all_fd160b_1588256404998-2] entityPath[spring-event-hub/ConsumerGroups/$Default/Partitions/2]: Returning existing receive link.
2020-04-30 19:50:11.024 INFO 6906 --- [ single-1] c.a.c.a.i.handler.ReceiveLinkHandler : onLinkLocalOpen connectionId[MF_dcd848_1588256404924], linkName[all_fd160b_1588256404998-0], localSource[Source{address='spring-event-hub/ConsumerGroups/$Default/Partitions/0', durable=NONE, expiryPolicy=SESSION_END, timeout=0, dynamic=false, dynamicNodeProperties=null, distributionMode=null, filter={apache.org:selector-filter:string=UnknownDescribedType{descriptor=apache.org:selector-filter:string, described=amqp.annotation.x-opt-offset > '-1'}}, defaultOutcome=null, outcomes=null, capabilities=null}]
2020-04-30 19:50:11.026 INFO 6906 --- [ single-1] c.a.c.a.i.handler.ReceiveLinkHandler : onLinkLocalOpen connectionId[MF_dcd848_1588256404924], linkName[all_fd160b_1588256404998-1], localSource[Source{address='spring-event-hub/ConsumerGroups/$Default/Partitions/1', durable=NONE, expiryPolicy=SESSION_END, timeout=0, dynamic=false, dynamicNodeProperties=null, distributionMode=null, filter={apache.org:selector-filter:string=UnknownDescribedType{descriptor=apache.org:selector-filter:string, described=amqp.annotation.x-opt-offset > '-1'}}, defaultOutcome=null, outcomes=null, capabilities=null}]
2020-04-30 19:50:11.026 INFO 6906 --- [ single-1] c.a.c.a.i.handler.ReceiveLinkHandler : onLinkLocalOpen connectionId[MF_dcd848_1588256404924], linkName[all_fd160b_1588256404998-2], localSource[Source{address='spring-event-hub/ConsumerGroups/$Default/Partitions/2', durable=NONE, expiryPolicy=SESSION_END, timeout=0, dynamic=false, dynamicNodeProperties=null, distributionMode=null, filter={apache.org:selector-filter:string=UnknownDescribedType{descriptor=apache.org:selector-filter:string, described=amqp.annotation.x-opt-offset > '-1'}}, defaultOutcome=null, outcomes=null, capabilities=null}]
2020-04-30 19:50:11.466 INFO 6906 --- [ single-1] c.a.c.a.i.handler.ReceiveLinkHandler : onLinkRemoteOpen connectionId[MF_dcd848_1588256404924], linkName[all_fd160b_1588256404998-1], remoteSource[Source{address='spring-event-hub/ConsumerGroups/$Default/Partitions/1', durable=NONE, expiryPolicy=SESSION_END, timeout=0, dynamic=false, dynamicNodeProperties=null, distributionMode=null, filter={apache.org:selector-filter:string=org.apache.qpid.proton.codec.DecoderImpl$UnknownDescribedType@2615c490}, defaultOutcome=null, outcomes=null, capabilities=null}]
2020-04-30 19:50:11.467 INFO 6906 --- [ single-1] c.a.c.a.i.handler.ReceiveLinkHandler : onLinkRemoteOpen connectionId[MF_dcd848_1588256404924], linkName[all_fd160b_1588256404998-0], remoteSource[Source{address='spring-event-hub/ConsumerGroups/$Default/Partitions/0', durable=NONE, expiryPolicy=SESSION_END, timeout=0, dynamic=false, dynamicNodeProperties=null, distributionMode=null, filter={apache.org:selector-filter:string=org.apache.qpid.proton.codec.DecoderImpl$UnknownDescribedType@76700147}, defaultOutcome=null, outcomes=null, capabilities=null}]
2020-04-30 19:50:11.470 INFO 6906 --- [ single-1] c.a.c.a.i.handler.ReceiveLinkHandler : onLinkRemoteOpen connectionId[MF_dcd848_1588256404924], linkName[all_fd160b_1588256404998-2], remoteSource[Source{address='spring-event-hub/ConsumerGroups/$Default/Partitions/2', durable=NONE, expiryPolicy=SESSION_END, timeout=0, dynamic=false, dynamicNodeProperties=null, distributionMode=null, filter={apache.org:selector-filter:string=org.apache.qpid.proton.codec.DecoderImpl$UnknownDescribedType@52d562e3}, defaultOutcome=null, outcomes=null, capabilities=null}]
Events per second ::0
Events per second ::316
Events per second ::818
Events per second ::409
Events per second ::87
Events per second ::21
Events per second ::12
Events per second ::5
Events per second ::3
Events per second ::4
Events per second ::3
Events per second ::4
Events per second ::4
Events per second ::5
Events per second ::5
Примечание: я проверил, увеличив TU, но не повезло