31
Global Windows Azure Bootcamp Hop on the Service Bus!

GWAB - Hop on the Service Bus!

Embed Size (px)

DESCRIPTION

Introduction session to Windows Azure Service Bus. NOTE - Slides are based on the Windows Azure Training Kit from which I reused slides

Citation preview

Page 1: GWAB - Hop on the Service Bus!

Global Windows Azure BootcampHop on the Service Bus!

Page 2: GWAB - Hop on the Service Bus!

Agenda• Introduction to Service Bus• Service Bus Relay• Service Bus Messaging• Service Bus Notification Hubs• Tools• Demo

3

Page 3: GWAB - Hop on the Service Bus!

Introduction to Service Bus

Page 4: GWAB - Hop on the 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

Page 5: GWAB - Hop on the Service Bus!

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

Page 6: GWAB - Hop on the 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.

Page 7: GWAB - Hop on the Service Bus!

Service Bus Relay

Page 8: GWAB - Hop on the Service Bus!

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

Page 9: GWAB - Hop on the Service Bus!

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

Page 10: GWAB - Hop on the Service Bus!

Service Bus Messaging

Page 11: GWAB - Hop on the Service Bus!

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

Page 12: GWAB - Hop on the Service Bus!

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

Page 13: GWAB - Hop on the Service Bus!

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

Page 14: GWAB - Hop on the Service Bus!

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

Page 15: GWAB - Hop on the Service Bus!

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

Page 16: GWAB - Hop on the Service Bus!

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

Page 17: GWAB - Hop on the Service Bus!

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

Page 18: GWAB - Hop on the Service Bus!

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.

Page 19: GWAB - Hop on the Service Bus!

Service Bus Notification Hubs

Page 20: GWAB - Hop on the Service Bus!

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

Page 21: GWAB - Hop on the Service Bus!

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

Page 22: GWAB - Hop on the Service Bus!

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

Page 23: GWAB - Hop on the Service Bus!

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

Page 24: GWAB - Hop on the Service Bus!

Tools

Page 25: GWAB - Hop on the Service Bus!

Windows Azure Tools for VS

➔ Official Visual Studio add-on➔ Service Bus support

➔ Queues & Topics➔ No notification hub & relays

➔ FREE!

Tools

Page 26: GWAB - Hop on the Service Bus!

Service Bus Explorer

➔ Full Service Bus support➔ Queues➔ Topics➔ Notification Hubs➔ Relay Services

➔ Open source - FREE!

Tools

Page 27: GWAB - Hop on the Service Bus!

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

Page 28: GWAB - Hop on the Service Bus!

DEMO

Page 29: GWAB - Hop on the Service Bus!

Queue demo

➔ Creating a queue➔ Sending a message➔ Receive / Peeking a message➔ Forwarding to other queue➔ Deadlettering➔ Duplicate detection

Service Bus Messaging

Page 30: GWAB - Hop on the Service Bus!

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

Page 31: GWAB - Hop on the Service Bus!

32