java - Reading deadlettered messages from service bus queue -


i know if it's possible read deadlettered messages azure service bus queue in java.

i found following example https://code.msdn.microsoft.com/windowsazure/brokered-messaging-dead-22536dd8/sourcecode?fileid=123792&pathid=497121593 however, haven't been able translate code java.

i found https://github.com/azure/azure-storage-java/tree/master/microsoft-azure-storage/src/com/microsoft/azure/storage there not seem deadlettering in there @ all.

i found several blogs (i'm not allowed put more links don't know if should anyway without proper tags). not describe how read deadlettered messages in java.

much in advance

i know it's old thread next lost soul looking solution...

i've been digging in .net sdk source , found it's simple http call "/$deadletterqueue", i.e.:

https://mynamespace.servicebus.windows.net/myqueuename/$deadletterqueue/messages/head  // peek-lock message dlq curl -x post -h "authorization: insertsashere" "https://mynamespace.servicebus.windows.net/myqueuename/%24deadletterqueue/messages/head" 

so using java sdk need read messages dead letter queue is:

service.receivequeuemessage(queuename + "/$deadletterqueue", opts); 

here's basic concrete example (destructive read):

public static void main(string[] args) throws serviceexception {      string namespace        = "namespace";     string sharedkeyname    = "keyname";     string sharedsecretkey  = "secretkey";     string queuename        = "queuename";            // azure service bus service     configuration config = servicebusconfiguration.configurewithsasauthentication(namespace, sharedkeyname, sharedsecretkey, ".servicebus.windows.net");     servicebuscontract service = servicebusservice.create(config);      // receive , delete messages dlq     receivemessageoptions opts = receivemessageoptions.default;     opts.setreceivemode(receivemode.receive_and_delete);      while (true) {         // messages dlq need "$deadletterqueue" uri         receivequeuemessageresult resultqm = service.receivequeuemessage(queuename + "/$deadletterqueue", opts);         brokeredmessage message = resultqm.getvalue();         if (message != null && message.getmessageid() != null) {             system.out.println("messageid: " + message.getmessageid());         } else {             system.out.println("no more messages.");             break;         }     } } 

of course isn't documented anywhere in rest api specs, typical microsoft...


Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -

How to provide Authorization & Authentication using Asp.net, C#? -