Closed Scarlettliuyc closed 3 years ago
hi team, here add more information: issue definition: The Service Bus JMS program get lock expired error. It use Peeklock mode, and set 30s for lock duration. Max message count is 1 investigation done: As the issue always happen in the client side, it's not the Service Bus server issue, and checked for the service bus namespace, it didn't have KPI drops or errors that time. When receive the message, it also send a emails out. We already test for the time duration before send or finish send email, it spent less than 1 s to finish it. But we cannot find where is the complete function of this JMS spring framework.
Reproducing steps: Set Max Message to 1, and lock duration to 30, it would have chance to got the "lock expired error"
SDK version:
<version>2.3.5</version>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.1.RELEASE</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>
Code: receive message: private EmailService emailService;
@JmsListener(destination = "${service.bus.queueName}", containerFactory = "jmsListenerContainerFactory")
public void receiveMessage(String msg) {
TemplateVO template = JSONObject.toJavaObject(JSON.parseObject(msg), TemplateVO.class);
log.info("Received message: {}", template);
emailService.sendTemplateEmail(template);
}
Ask: where can we find the complete function to test the complete time? searched for acknowledge or complete cannot find it ?
thanks
@hemanttanwar could you please assist?
@Scarlettliuyc Thank You for the query. I was able to run the sample at https://github.com/Azure/azure-sdk-for-java/tree/master/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-servicebus-jms-queue . I also added some delay in receiving side but I did not see the issue.
We are still looking into it and will update you.
thanks @hemanttanwar could you please tell me where can we find the complete function? I checked it should have completed. we are trying to find which part spent longer time and cause lock expired error
hi @Scarlettliuyc,
do you mean that you want to know where the @JmsListener be called?
I think you can check and debug the method org.springframework.jms.listener.DefaultMessageListenerContainer.AsyncMessageListenerInvoker#executeOngoingLoop
inside the method body, it called invokeListener()
where the listener be called.
thanks @backwind1233 as I know service bus message should receive and complete message, I know here it's to receive message, is that @JmsListener(destination = "${service.bus.queueName}", containerFactory = "jmsListenerContainerFactory")
is this org.springframework.jms.listener.DefaultMessageListenerContainer.AsyncMessageListenerInvoker#executeOngoingLoop can complete the message, thank you
hi team, for the receive mode When using the "azure-servicebus-jms-spring-boot-starter" package, did not set the receive mode, and used the default mode. When change to use "azure-messaging-servicebus" package, set the receive mode to RECEIVE_AND_DELETE.
could you please tell me any more information you needed?
Query/Question hi team , we found there is an lock expired error when using peek lock mode in JMS Spring Service bus SDK.
We tried to check the time in our system. @JmsListener(destination = "${service.bus.queueName}", containerFactory = "jmsListenerContainerFactory")
for receive message, we only spent less than 200ms in receive and send out email in our functions. However the default lock duration time is 30s,
Questions: where can we find the complete function in JMS spring Service Bus SDK. It confirmed have complete in any Encapsulation functions in the SDK . We want to check the complete time and extend the lock duration time based on the total time with receive and complete the message.
We are grateful for your reply.