Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Azure ServiceBus Queues and Topics

2,569 views

Published on

Overview of the API to control Queues and Topics in Azure AppFabric ServiceBus

Published in: Technology, Business
  • Be the first to comment

Azure ServiceBus Queues and Topics

  1. 1. Igor Moochnick Director, Cloud Platforms BlueMetal Architects [email_address] Blog: igorshare.wordpress.com
  2. 6. Broker Broker
  3. 7. See: http://bit.ly/tY96CZ Feature Azure Queues Brokered Messaging API REST, .NET .NET, REST, WCF Authentication Storage Service HMAC Service Bus ACS Maximum queue size 100TB 5GB Maximum message size 64KB 256KB Maximum message TTL 7 days 10,675,199 days At most once delivery No Yes At least once delivery Yes Yes Maximum message lock 7 days 5 minutes Hosted service affinity Yes No Receive behavior Non-blocking Long polling (<24 days) Throughput 5,000 msgs/second 800-3,000 msgs/sec
  4. 9. Broker Message Body Properties
  5. 11. 1 2 3
  6. 12. Management operations on the namespace Create/Delete/Exists for Queues, Topics, and Subscriptions 1 2 3 4
  7. 13. Creates client objects to interact with Queues, Topics, and Subscriptions. Anchor for connection management and multiplexing. 1 2 3 4
  8. 14. 1 2 3
  9. 15. var queueClient = factory .CreateQueueClient(queueName); queueClient.Send(message); queueClient.BeginSend(message, DoneSending, queueClient); void DoneSending( IAsyncResult ar) { var queueClient = ( QueueClient )ar.AsyncState; queueClient.EndSend(ar); } var sender = factory .CreateMessageSender(queueName); sender.Send(message); 1 2 3 Sending messages is done with Send or Begin/EndSend. You can send on the QueueClient or TopicClient or the neutral MessageSender .
  10. 16. var queueClient = factory .CreateQueueClient(queueName, ReceiveMode .ReceiveAndDelete ); var message = queueClient.Receive(TimeSpan.FromMinutes(1)); if ( message != null ) { … queueClient.BeginReceive(TimeSpan.FromMinutes(1), DoneReceiving, queueClient); void DoneReceiving( IAsyncResult ar) { var queueClient = ( QueueClient )ar.AsyncState; var message = queueClient.EndReceive(ar); if ( message != null ) { … 1 2 Destructive receives remove the messages from the queue as it is being taken from the broker. Higher throughput than Peek/Lock, but risk of message loss.
  11. 17. var queueClient = factory .CreateQueueClient(queueName, ReceiveMode .PeekLock ); var message = queueClient.Receive(TimeSpan.FromMinutes(1)); if ( message != null ) { try { .. processing work .. message.Complete(); } catch { message.Abandon(); throw ; } 1
  12. 18. Management operations on the namespace Create/Delete/Exists for Queues, Topics, and Subscriptions 1 2 3
  13. 19. var subClient = factory .CreateSubscriptionClient(topicName, subName, ReceiveMode .ReceiveAndDelete ); var message = subClient.Receive(TimeSpan.FromMinutes(1)); if ( message != null ) { … var rcv = factory .CreateMessageReceiver( SubscriptionClient .FormatSubscriptionPath(topicName, subName), ReceiveMode .ReceiveAndDelete ); var message = rcv.Receive(TimeSpan.FromMinutes(1)); if ( message != null ) { … 1 2
  14. 20. Filter conditions operate on message properties and are expressed in SQL’92 syntax SET AuditRequired = 1 Filters actions may modify/add/remove properties as message is selected
  15. 25. var policy = new RetryPolicy <SqlAzureTransientErrorDetectionStrategy>(MaxRetries, TimeSpan .FromMilliseconds(DelayMs)); policy.ExecuteAction(() => object.DoSomething());

×