Question

I'm new Azure developer. My scenario is something like manager will publish new topic/queue by website/wp8 and worker should get notification (by push notification) in wp8 about newly added topic/queue. At this moment I have all the pieces ready such as topic/queue creation, sending receiving. But it works on pulling basis. Meaning manager can crate topic and publish message. Then worker has to subscribe to the topic for receiving message and pull every time to check is there anything new?.

So I want to make this system based on notification. I meant whenever anything newly added in topic user should get a notification (by push notification). So can you suggest me how can I achieve this goal? Is there any event generates from service bus if topic added or removed, etc? Thanks in advance!

Was it helpful?

Solution

Unfortunately there is no "notification hook" for when a queue/topic is created. The two options I'd recommend are to either use the service bus management API to periodically scan for new queues/topics, or better yet, set up a "notification topic" which your worker role instances can then listen to. Dropping a message into this topic can be another action performed by the "manager" process when it provisions a new topic/queue.

However, if you could explain the larger scenario of what you're trying to accomplish, I can't help but suspect that there may be a better way to accomplish what you're after. As after a period of time, all those topics/queues could present some management challenges.

OTHER TIPS

off course we do have events which notifies the client when a new message is added to Topic .With message pump mechanism you can hook a client to Topic messages with a valid subscription .

Essentially the code bellow shows how to subscribe to the topic .

    static void Main(string[] args)
    {


        SubscriptionClient Client = null;

        OnMessageOptions options;
        string connectionString = "your topic Endpoint";

        Client =
           SubscriptionClient.CreateFromConnectionString
                   (connectionString, "YourTopicName", "YoursubscriberName");

        // Configure the callback options.
        options = new OnMessageOptions();
        options.AutoComplete = false;
        options.AutoRenewTimeout = TimeSpan.FromMinutes(1);

        Client.OnMessage((message) =>
        {
            try
            {
                 Console.WriteLine("Topic Message :  ID :" + message.MessageId + " , " + message.Label);


                message.Complete();



            }
            catch (Exception exp)
            {

                message.Abandon();
                Console.WriteLine("**Error Reciving Message**");

            }


        }, options);

        Console.ReadLine();
    }
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top