0

We have a springboot application running in Azure Web App (using container docker)

The application is using "azure-spring-cloud-stream-binder-servicebus-queue" to connect to Azure Service Bus and process the queue.

If the queue was empty for some time, and when there is a new request coming into the queue, our application was not able to pick up the new request until we restart the application.

Has anyone encountered this before and can share their experience.

@Bean
public Consumer<Message<String>> onReceive() {
   return message -> {
   String msg = message.getPayload();
   //logic to process the msg
   };
}

Here is the 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.5.6</version>
    <relativePath />
    <!-- lookup parent from repository -->
</parent>
<groupId>xxx</groupId>
<artifactId>xxx</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>xxx</name>
<description>xxx</description>
<properties>
    <java.version>11</java.version>
    <azure.version>3.10.0</azure.version>
    <spring-cloud.version>2020.0.4</spring-cloud.version>
    <maven.test.skip>true</maven.test.skip>
</properties>
<dependencies>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>
    <dependency>
        <groupId>com.azure.spring</groupId>
        <artifactId>azure-spring-boot-starter</artifactId>
    </dependency>
    <dependency>
        <groupId>com.microsoft.sqlserver</groupId>
        <artifactId>mssql-jdbc</artifactId>
        <scope>runtime</scope>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-data-jpa</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-stream</artifactId>
    </dependency>
    <dependency>
        <groupId>com.azure.spring</groupId>
        <artifactId>azure-spring-boot-starter</artifactId>
    </dependency>
    <dependency>
        <groupId>com.azure.spring</groupId>
        <artifactId>azure-spring-cloud-stream-binder-servicebus-queue</artifactId>
        <version>2.10.0</version>
    </dependency>
    <dependency>
        <groupId>org.projectlombok</groupId>
        <artifactId>lombok</artifactId>
        <optional>true</optional>
    </dependency>
    <dependency>
        <groupId>redis.clients</groupId>
        <artifactId>jedis</artifactId>
        <version>3.7.0</version>
    </dependency>
</dependencies>
<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-dependencies</artifactId>
            <version>${spring-cloud.version}</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
        <dependency>
            <groupId>com.azure.spring</groupId>
            <artifactId>azure-spring-boot-bom</artifactId>
            <version>${azure.version}</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
    </dependencies>
</dependencyManagement>
</project>

Application Setting

spring.cloud.azure.servicebus.connection-string=${BRT_SMS_SB_CONNECTIONSTRING}
spring.cloud.stream.bindings.onReceive-in-0.group=consumer
spring.cloud.stream.bindings.onReceive-in-0.destination=${BRT_SMS_SB_QUEUE}
spring.cloud.azure.stream.function.definition=consume;
spring.cloud.azure.stream.poller.fixed-delay=5000
spring.cloud.azure.stream.poller.initial-delay=0

** Basically I'm referring to this article

WenHao
  • 1,183
  • 1
  • 15
  • 46
  • Can you share some code? – DaShaun Apr 03 '22 at 14:27
  • @DaShaun editted my question. Also I notice that my service bus active connection was 0 during that time. – WenHao Apr 03 '22 at 14:50
  • I think I've seen this before. I feel like there is a keep alive/timeout config that needs to be changed. Can you share you application.yaml? Are you using the exact same code as that example? – DaShaun Apr 03 '22 at 16:18
  • @DaShaun inlcuded the setting in the post. I'm not using the application.yaml. I was specifying those configuration in my application.properties. – WenHao Apr 04 '22 at 04:03

0 Answers0