How to read Azure Service Bus messages from Multiple Queues with one worker -


i have 3 queues , 1 worker want monitoring 3 queues (or 2 of them)

one queue qpirate 1 queue qships 1 queue qpassengers

the idea workers either looking @ 3 of them, 2 of them, or 1 of them, , doing different things depending on message says.

the key though message failing because ship1 offline, queues in qships refresh, workers looking @ , other queues hung try process messages queue while looking @ other queues little bit, while other workers looking @ other 2 queues , skipping qships continue process through messages without holdup or delays.

    public static void gotmessage([servicebustrigger("%lookatallqueuesintheservicebus%")] brokeredmessage message)     {         var handler = new messagehandler();          var manager = new messagemanager(             handler,             "pirateships"             );          manager.processmessageviahandler(message);     } 

looking around online i'm guessing isn't that's possible, seems be? in advance either way!

edit1: i'll add job host attempt clarify things bit

        jobhostconfiguration config = new jobhostconfiguration()         {             dashboardconnectionstring = "defaultendpointsprotocol=https;accountname=piratesareus;accountkey=yarr",             storageconnectionstring = "defaultendpointsprotocol=https;accountname=piratesareus;accountkey=yarr",             nameresolver = new queuenameresolver()         };          servicebusconfiguration servicebusconfig = new servicebusconfiguration()         {             connectionstring = "endpoint=allpiratequeueslocatedhere;sharedaccesskeyname=piratesareus;sharedaccesskey=yarr"                        };          servicebusconfig.messageoptions.autocomplete = false;         servicebusconfig.messageoptions.autorenewtimeout = timespan.fromminutes(1);         servicebusconfig.messageoptions.maxconcurrentcalls = 1;                      config.useservicebus(servicebusconfig);           jobhost host = new jobhost(config);          host.runandblock(); 

also queuenameresolverclass simply

    public class queuenameresolver : inameresolver     {         public string resolve(string name)         {             return name;         }     } 

i don't appear have anyway have nameresolver multiple queues, while can want jobhost @ servicebus, don't know how tell @ queues within servicebus.

in other words, want multiple servicebustriggers on worker if message gets sent qpirate1 , qships1 both located in service bus allpiratequeueshere, worker can pick message in qpirate1, process it, pick message in qships1 , process it.

figured out answer... possible , simpler thought i'm not sure why didn't connect dots i'm still curious why there isn't more documentation this. apparently it's make function per queue want worker @ multiple queues. if had 3 queues you'd want below (you can handle each message differently).

  public static void gotmessage1([servicebustrigger("%qpirate1%")] brokeredmessage message) {     var handler = new messagehandler();      var manager = new messagemanager(         handler,         "pirates"         );      manager.processmessageviahandler(message); }    public static void gotmessage2([servicebustrigger("%qship1%")] brokeredmessage message) {     var handler = new messagehandler();      var manager = new messagemanager(         handler,         "ships"         );      manager.processmessageviahandler(message); }    public static void gotbooty([servicebustrigger("%qbooty%")] brokeredmessage message) {     var handler = new messagehandler();      var manager = new messagemanager(         handler,         "booty"         );      manager.processmessageviahandler(message); } 

Comments

Popular posts from this blog

javascript - Slick Slider width recalculation -

jsf - PrimeFaces Datatable - What is f:facet actually doing? -

angular2 services - Angular 2 RC 4 Http post not firing -