.net - Azure web app to web app communication -
i have 2 web separate apps in azure, 1 administer content, , other displaying content.
currently i'm sending http requests admin app public app clear in-memory caches of various objects.
this works fine, won't scale out more 1 instance.
so, i've begun investigate service bus topics pub/sub model communication.
i've had no trouble sending message topic admin app, can't sort out how consume these messages public app.
there plenty of examples of doing inside worker role or web job, can't find examples of receiving messages web app.
further, once sort out, need handle separate subscriptions each instance. idea use website_instance_id in subscription. has done this, or there better solutions multiple instances?
or, there better way handle distributed cache clearing?
there no real difference between receiving web app or worker role; need spin background thread on startup work. when app instance on machine spins down background thread should terminate.
if you're using .net, easiest way using onmessage api don't have write own loop. create subscription client in app on startup , initialize onmessage callback. when app signals shutdown close client clean exit.
the idea of using instance-id subscription name one. can do, if want give web app instances "manage" permission on topic, create volatile subscription named random identifier (guid?).
volatile subscriptions auto-delete when having been idle (i.e. have not been pulled on, message flow not required keep them alive) , enabled autodeleteonidle flag.
Comments
Post a Comment