Code Monkey home page Code Monkey logo

Comments (6)

ashok2ashok avatar ashok2ashok commented on July 20, 2024

To the above code if I add the below:

SessionHandlerOptions sessionHandlerOptions = new SessionHandlerOptions(1, true, Duration.ofMinutes(5));
subscriptionClient.registerSessionHandler(new ISessionHandler() {...}, sessionHandlerOptions);

and change the return in onMessageAsync to the below:

return CompletableFuture.completedFuture(null);

Then I get the below errors. Some messages are received but I get the below errors and the program hangs:

2018-02-23 11:37:17,814 [24-7360c77df5c2] - ERROR RequestResponseLink            - Opening internal send link of requestresponselink to sample-order-status/subscriptions/sample-hybris-order-status-subscription/$management failed.
com.microsoft.azure.servicebus.primitives.AuthorizationFailedException: Unauthorized access. 'Send' claim(s) are required to perform this operation. Resource: 'sb://ashokgoli.servicebus.windows.net/sample-order-status/subscriptions/sample-hybris-order-status-subscription/$management'. TrackingId:cbe7e9aa831a455abdaa17aacb814497_G27, SystemTracker:gateway6, Timestamp:2/23/2018 5:37:17 PM
	at com.microsoft.azure.servicebus.primitives.ExceptionUtil.toException(ExceptionUtil.java:50)
	at com.microsoft.azure.servicebus.primitives.RequestResponseLink$InternalSender.onClose(RequestResponseLink.java:743)
	at com.microsoft.azure.servicebus.amqp.BaseLinkHandler.processOnClose(BaseLinkHandler.java:68)
	at com.microsoft.azure.servicebus.amqp.BaseLinkHandler.onLinkRemoteClose(BaseLinkHandler.java:42)
	at org.apache.qpid.proton.engine.BaseHandler.handle(BaseHandler.java:176)
	at org.apache.qpid.proton.engine.impl.EventImpl.dispatch(EventImpl.java:108)
	at org.apache.qpid.proton.reactor.impl.ReactorImpl.dispatch(ReactorImpl.java:309)
	at org.apache.qpid.proton.reactor.impl.ReactorImpl.process(ReactorImpl.java:276)
	at com.microsoft.azure.servicebus.primitives.MessagingFactory$RunReactor.run(MessagingFactory.java:451)
	at java.base/java.lang.Thread.run(Thread.java:844)

Resolved the above by adding Send claim to listen-only policy by following : Azure/azure-service-bus-java#110

and

2018-02-23 11:37:47,541 [nPool-worker-15] - ERROR RequestResponseLinkcache       - Creating requestresponselink to 'sample-order-status/subscriptions/sample-hybris-order-status-subscription/$management' failed.
com.microsoft.azure.servicebus.primitives.TimeoutException: Open operation on RequestResponseLink(05a91c-RequestResponse) on Entity(sample-order-status/subscriptions/sample-hybris-order-status-subscription/$management) timed out at 2018-02-23T11:37:47.540528-06:00[America/Chicago].
	at com.microsoft.azure.servicebus.primitives.RequestResponseLink$1.run(RequestResponseLink.java:77)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:514)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:299)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
	at java.base/java.lang.Thread.run(Thread.java:844)

from azure-docs-sdk-java.

petersonpius avatar petersonpius commented on July 20, 2024

Hi Ashok,
Do you see messages from all sessions getting processed.In my case if the max session is 1 only messages from 1 session is received. Rest of the session messages are not processed.

from azure-docs-sdk-java.

ashok2ashok avatar ashok2ashok commented on July 20, 2024

I have a similar issue. I am not able to mark the message as complete or abandon through session or SubscriptionClient.

from azure-docs-sdk-java.

petersonpius avatar petersonpius commented on July 20, 2024

if you are PeekLock mode return session.completeAsync(message.getLockToken())

@OverRide
public CompletableFuture onMessageAsync(IMessageSession session, IMessage message)
{
String messageString = new String(message.getBody(), StandardCharsets.UTF_8);
System.out.println("Received message:**** " + messageString);
return session.completeAsync(message.getLockToken());

}

Also for renewing the sessions use-
@OverRide
public CompletableFuture OnCloseSessionAsync(IMessageSession session)
{
return session.renewSessionLockAsync();
}

from azure-docs-sdk-java.

sima-zhu avatar sima-zhu commented on July 20, 2024

@ashok2ashok Is this still an issue for you? If not, I will close it by the end of next week.

from azure-docs-sdk-java.

joshfree avatar joshfree commented on July 20, 2024

Closing old issue with no follow up.

from azure-docs-sdk-java.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.