gwab - hop on the service bus!
DESCRIPTION
Introduction session to Windows Azure Service Bus. NOTE - Slides are based on the Windows Azure Training Kit from which I reused slidesTRANSCRIPT
Global Windows Azure BootcampHop on the Service Bus!
Agenda• Introduction to Service Bus• Service Bus Relay• Service Bus Messaging• Service Bus Notification Hubs• Tools• Demo
3
Introduction to Service Bus
Notification HubNotifications to mobile devices
QueuesMessage delivery with Queues
TopicsMessage delivery with Topics
RelayConnect on-premise with Cloud
Windows Azure Service Bus Namespace
Messaging Notification Connectivity
Service Bus & Access Control
➔ Each SB-namespace has an ACS-namespace➔ SB Namespace : [name].servicebus.windows.net➔ ACS Namespace : [name]-
sb.accesscontrol.windows.net
➔ Preconfigured ACS settings➔ Relying party➔ Service identity ‘owner’➔ Cannot be deleted
6
Introduction to Service Bus
Service Bus Rights & Claims
7
Introduction to Service Bus
Service Bus defines one authorization claim type with three possible values that indicate the authorized operation(s) ‘net.windows.servicebus.action’ ‘Send’ – Permit ‘send’ operations on a Service Bus entity‘Listen’ – Permit ‘send’ or ‘receive’ operations on a Service Bus entity‘Manage’ – Permit management operations like creating, inspecting, or deleting Service Bus entities.
Service Bus Relay
What is a Service Bus Relay?
➔ Hybrid scenario➔ Expose on-premise WCF services➔ “Relay” connection with 3th party & cloud➔ ACS security on endpoints
➔ Service Bus WCF bindings
Service Bus Relay
Relay Programming Model
10
Service Bus Relay
Full WCF Programming ModelBindings functionally symmetric with WCFWebHttpRelayBinding (HTTP/REST)BasicHttpRelayBinding (SOAP 1.1)WS2007HttpRelayBinding (SOAP 1.2)NetTcpRelayBinding (Binary transport)
Special Service Bus BindingsNetOnewayRelayBinding (Multicast one-way)NetEventRelayBinding (Multicast one-way)
Transport binding elements for custom binding stacks
WebHttpRelayBinding provides full interoperability with any HTTP/REST client, BasicHttpRelayBinding with any SOAP client
Service Bus Messaging
Brokered MessagesService Bus Messaging
Broker MessageBrokered messaging properties are not SOAP headersProperties are key/value pairs that may very well carry payloadsIt’s not uncommon to have messages with empty message bodiesMessage bodies are useful for a single opaque payload not exposed to the broker (e.g. encrypted content)
Body
Properties
Relay vs. Message Broker
13
Service Bus Messaging
The Relay routes messages ‘straight through’ with feedback path and network backpressure into sender
Route
AuthN/Z Backpressure Feedback Relay
Query FilterPull
AuthN/ZBroker
Brokers hold messages for retrieval and querying
Queues
14
Service Bus Messaging
Load LevelingReceiver receives and processes at its own pace. Can never be overloaded. Can add receivers as queue length grows, reduce receiver if queue length is low or zero. Gracefully handles traffic spikes by never stressing out the backend.
Offline/BatchAllows taking the receiver offline for servicing or other reasons. Requests are buffered up until the receiver is available again.
Queue
QueuesService Bus Messaging
Load BalancingMultiple receivers compete for messages on the same queue (or subscription). Provides automatic load balancing of work to receivers volunteering for jobs.Observing the queue length allows to determine whether more receivers are required.
Queue
Queues
16
Service Bus Messaging
Receive and DeleteFastest. Message lost if receiver crashes or transmission fails.
Peek LockMessage is locked when retrieved. Reappears on broker when not deleted within lock timeout.
TransactionalLocal model
Broker
Broker
Broker
Relay vs. Message Broker
The Relay routes messages ‘straight through’ with feedback path and network backpressure into sender
Route
AuthN/Z Backpressure Feedback Relay
Query FilterPull
AuthN/ZBroker
Brokers hold messages for retrieval and querying
Service Bus Queues vs Storage Queues
➔ Storage Queue➔ Unlimited queues➔ Unlimited queue size➔ Max 8 KB messages➔ Max Time-To-Live = 7
days➔ No WCF support➔ REST only➔ Windows Azure
credentials➔ No ordering guarantee 18
Service Bus Messaging
➔ Service Bus Queue➔ Max 10 000 queues in
sb-ns➔ 5 GB queue cap➔ Max 256KB messages➔ Infinite Time-To-Live➔ WCF support➔ REST & TCP➔ ACS roles➔ FIFO order guarantee
Topics
19
Service Bus Messaging
TopicSubSubSub
Message DistributionEach receiver gets its own copy of each message. Subscriptions are independent. Allows for many independent ‘taps’ into a message stream. Subscriber can filter down by interest.
Service Bus Notification Hubs
How Push Notifications WorkService Bus Notification Hubs
Retrieve device handle
PNS(APNS, WNS,
GCM)
Store handle in app back-end
Send notification to handle
Device notified (even when app is inactive)
Backend
Client
Downsides of Push Notifications
➔ Target multiple platforms Code multiple interfaces
➔ No broadcast Send message one-by-one➔ No recipient filtering➔ No monitoring
22
Service Bus Notification Hubs
How Service Bus Notification Hub WorksService Bus Notification Hubs
Retrieve device handle
PNS
Registration with tagsSend notification to handle
Push notification
Client
Backend
Service Bus Notification Hub
Service Bus Notification Hub to the rescue!
➔ Cross-platform out-of-the-box➔ Works on any backend (cloud or on-premise)➔ Personalized push notifications➔ Easy-to-use infrastructure➔ Delivery patterns
➔ Broadcast➔ Filter recipient based on tags
➔ Monitoring in portal or by code
24
Service Bus Notification Hubs
Tools
Windows Azure Tools for VS
➔ Official Visual Studio add-on➔ Service Bus support
➔ Queues & Topics➔ No notification hub & relays
➔ FREE!
Tools
Service Bus Explorer
➔ Full Service Bus support➔ Queues➔ Topics➔ Notification Hubs➔ Relay Services
➔ Open source - FREE!
Tools
Azure Management Studio
➔ Storage➔ Storage accounts➔ Blob (Containers)➔ Tables➔ Queues
➔ Diagnostics➔ Diagnostics Logs &
Mgmt➔ Performance Counters➔ Dashboard
Tools
➔ Management➔ Subscriptions➔ Cloud Services➔ Virtual Machines➔ Service Bus Queues➔ SQL Database
➔ Price - €146
DEMO
Queue demo
➔ Creating a queue➔ Sending a message➔ Receive / Peeking a message➔ Forwarding to other queue➔ Deadlettering➔ Duplicate detection
Service Bus Messaging
Topics demo
➔ Creating a topic➔ Creating subscriptions➔ Sending a message from subscription➔ Receive a message from subscription➔ Duplicate detection on topic➔ Deadlettering on subscription➔ Forwarding to other entity
Service Bus Messaging
32