Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[QUERY] Peek-Lock mode on sessionful subscriptions with custom session idle timeout #44414

Open
2 tasks done
pboschmann opened this issue Feb 26, 2025 · 2 comments
Open
2 tasks done
Assignees
Labels
azure-spring All azure-spring related issues Client This issue points to a problem in the data-plane of the library. customer-reported Issues that are reported by GitHub users external to the Azure organization. needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team question The issue doesn't require a change to the product in order to be resolved. Most issues start as that
Milestone

Comments

@pboschmann
Copy link

Query/Question
Hello and thank you for your time.
I am working on an integration of a Spring Boot project with the Azure Service Bus. Is it possible at all to create a message consumer in peek-lock mode for sessionful subscriptions using the @ServiceBusListener annotation with custom session idle timeout or am I simply overlooking something mundane?

Example:

@ServiceBusListener(destination = "${spring.cloud.azure.servicebus.entity-name}", group = "${spring.cloud.azure.servicebus.processor.subscription-name}")
@Override
public void listen(final String input) {
    log.debug("Received {}", input);
}

When I subscribe on a sessionfull subscription using the code above I get this error (on non sessionfull subscriptions the receiver is created and consumes messages just fine):
It is not possible for an entity that requires sessions to create a non-sessionful message receiver.
I used the following application.properties (also tried the processor prefix instead of consumer without luck). As you can see the session-enabled property is set to true, but the SDK instantiates a non-sessionful reicever.

spring.cloud.azure.servicebus.enabled=true
spring.cloud.azure.servicebus.domain-name=...
spring.cloud.azure.servicebus.namespace=...
spring.cloud.azure.servicebus.connection-string=Endpoint=...
spring.cloud.azure.servicebus.entity-type=topic
spring.cloud.azure.servicebus.entity-name=...
spring.cloud.azure.servicebus.consumer.subscription-name=...
spring.cloud.azure.servicebus.consumer.session-enabled=true
spring.cloud.azure.servicebus.consumer.auto-complete=true
spring.cloud.azure.servicebus.consumer.receive-mode=peek_lock

I was able to create a workaround by implementing a custom CustomServiceBusMessageListenerContainerFactory where I set the properties by myself. In this case messages will be consumed but I don't know how I can manipulate the session idle timeout. The value for "message lock duration" on the subscription itself seems to be completely ignored – I setup a value of 8 seconds, but according to logs the timeout occurs after 1 minute
As far as I understand this possibility was implemented in MR 34700 but it seems to me it works only with the fluent API.

Why is this not a Bug or a feature Request?
Service Bus and the Java SDK make the impression of mature products, after tinkering for weeks I just hope that I overlook something.

Setup (please complete the following information if applicable):

  • OS: macOS 13.2
  • openJDK 21
  • IDE: IntelliJ
  • Library/Libraries: relevant snippets from pom.xml below
<spring-cloud.version>2024.0.0</spring-cloud.version>
<com.azure.spring.cloud.version>5.20.0</com.azure.spring.cloud.version>
<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>3.4.2</version>
    <relativePath/> <!-- lookup parent from repository -->
</parent>

<dependency>
    <groupId>com.azure.spring</groupId>
    <artifactId>spring-cloud-azure-starter</artifactId>
</dependency>
<dependency>
    <groupId>com.azure.spring</groupId>
    <artifactId>spring-messaging-azure-servicebus</artifactId>
</dependency>


<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>com.azure.spring</groupId>
            <artifactId>spring-cloud-azure-dependencies</artifactId>
            <version>5.20.0</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
    </dependencies>
</dependencyManagement>

Information Checklist
Kindly make sure that you have added all the following information above and checkoff the required fields otherwise we will treat the issuer as an incomplete report

  • Query Added
  • Setup information Added
@github-actions github-actions bot added azure-spring All azure-spring related issues Client This issue points to a problem in the data-plane of the library. customer-reported Issues that are reported by GitHub users external to the Azure organization. needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team question The issue doesn't require a change to the product in order to be resolved. Most issues start as that labels Feb 26, 2025
Copy link
Contributor

Copy link
Contributor

Thank you for your feedback. Tagging and routing to the team member best able to assist.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
azure-spring All azure-spring related issues Client This issue points to a problem in the data-plane of the library. customer-reported Issues that are reported by GitHub users external to the Azure organization. needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team question The issue doesn't require a change to the product in order to be resolved. Most issues start as that
Projects
Status: Todo
Development

No branches or pull requests

3 participants