driving the azure service bus scott klueppel solutions architect soalutions, inc. #jaxcodeimpact...

41
Driving the Azure Service Bus Scott Klueppel Solutions Architect SOAlutions, Inc. #jaxcodeimpact @kloopdogg

Upload: judith-rodgers

Post on 26-Dec-2015

215 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Driving the Azure Service Bus Scott Klueppel Solutions Architect SOAlutions, Inc. #jaxcodeimpact @kloopdogg

Driving theAzure Service Bus

Scott KlueppelSolutions Architect

SOAlutions, Inc.

#jaxcodeimpact

@kloopdogg

Page 2: Driving the Azure Service Bus Scott Klueppel Solutions Architect SOAlutions, Inc. #jaxcodeimpact @kloopdogg

- Feature Overview - Management Portal / Tools - Relayed vs. Brokered Messaging - Cloud Design Patterns - Building Hybrid/Cross-Platform Systems

Azure Service BusAgenda

Page 3: Driving the Azure Service Bus Scott Klueppel Solutions Architect SOAlutions, Inc. #jaxcodeimpact @kloopdogg

Azure Service BusFeature OverviewManagement PortalTools

Page 4: Driving the Azure Service Bus Scott Klueppel Solutions Architect SOAlutions, Inc. #jaxcodeimpact @kloopdogg

- Cross-platform middleware - Unified set of messaging capabilities - Request/Response - One-way - Queued - Publish/Subscribe

Azure Service BusWhat is the Service Bus?

Page 5: Driving the Azure Service Bus Scott Klueppel Solutions Architect SOAlutions, Inc. #jaxcodeimpact @kloopdogg

Windows AzureSDK

Visual Studio2013

Visual Studio2012

Visual Studio2010

2.4 Aug2014

Supported Supported Not Supported

2.3 Apr2014

Supported Supported Not Supported

2.2 Oct2013

Supported Supported Not Supported

2.1 Jul2013

Not Supported Supported Supported

- SDK contains client libraries - MS Committed to backwards compatibility

Azure Service BusWindows Azure SDK

Page 6: Driving the Azure Service Bus Scott Klueppel Solutions Architect SOAlutions, Inc. #jaxcodeimpact @kloopdogg

DemoManagement Portal

Tools

Page 7: Driving the Azure Service Bus Scott Klueppel Solutions Architect SOAlutions, Inc. #jaxcodeimpact @kloopdogg

Relayed MessagingFeaturesDemo

Page 8: Driving the Azure Service Bus Scott Klueppel Solutions Architect SOAlutions, Inc. #jaxcodeimpact @kloopdogg

-A centralized service that offers connectivity options for clients and servers communicating in challenging network scenarios-Permits one-way, request/response messaging-Supports SOAP, WS-*, optimized for WCF

-Service hosts are “Listeners”-Clients only call the relay service

What is a relay? Relays

Page 9: Driving the Azure Service Bus Scott Klueppel Solutions Architect SOAlutions, Inc. #jaxcodeimpact @kloopdogg

On-Premise

How does it work? Relays

WCF Service

Remote

Client

Service Bus

SendShared Secret

ReturnToken

1

2

Open RelayConnection

3

SendShared Secret

ReturnToken

4

5

Sendmessage

6

Deliver message8

Relay message (load balancing)7

Access Control Service

Page 10: Driving the Azure Service Bus Scott Klueppel Solutions Architect SOAlutions, Inc. #jaxcodeimpact @kloopdogg

Fire

wall

NAT

NAT

Fire

wall

Corporate

RelaysScenario 1: Network Infrastructure

Client

On-Premise

Web App

Other Service

Dynamic IPsNo LB/ACE

Relay

WCF Service

Page 11: Driving the Azure Service Bus Scott Klueppel Solutions Architect SOAlutions, Inc. #jaxcodeimpact @kloopdogg

Fire

wall

NAT

NAT

Fire

wall

Corporate

RelaysScenario 2: Emergency Use

Client

On-Premise

Web App

Other ServiceRela

y

WCF Service

WCF Service

Page 12: Driving the Azure Service Bus Scott Klueppel Solutions Architect SOAlutions, Inc. #jaxcodeimpact @kloopdogg

Fire

wall

NAT

NAT

Fire

wall

Corporate .

RelaysScenario 3: Roaming Devices

Client

On-Premise

Web App

Other Service

Coffee Shop . Client

Relay

WCF Service

Page 13: Driving the Azure Service Bus Scott Klueppel Solutions Architect SOAlutions, Inc. #jaxcodeimpact @kloopdogg

1. If there are no listeners, the service is unavailable

2. No automatic scaling for high bursts of traffic

3. Load balancing is not configurable4. Ports 9350-9353 (outbound only)

Considerations Relays

Page 14: Driving the Azure Service Bus Scott Klueppel Solutions Architect SOAlutions, Inc. #jaxcodeimpact @kloopdogg

DemoConvert to Relay

Load balancing

Page 15: Driving the Azure Service Bus Scott Klueppel Solutions Architect SOAlutions, Inc. #jaxcodeimpact @kloopdogg

Brokered MessagingFeaturesDemos

Page 16: Driving the Azure Service Bus Scott Klueppel Solutions Architect SOAlutions, Inc. #jaxcodeimpact @kloopdogg

- Sender makes asynchronous calls- Messages are durably stored in a broker- Broker holds messages until receiver is available

- Ideal for distributed or occasionally-connected systems- Service Bus offers queues and topics … and soon event hubs

What is brokered messaging?

Page 17: Driving the Azure Service Bus Scott Klueppel Solutions Architect SOAlutions, Inc. #jaxcodeimpact @kloopdogg

- Messages are durably stored until consumed- Messages pulled from queue by one or more competing consumers

- Benefits: - Temporal decoupling - Load leveling - Load balancing

Queues Queues

Page 18: Driving the Azure Service Bus Scott Klueppel Solutions Architect SOAlutions, Inc. #jaxcodeimpact @kloopdogg

- Messages are durably stored until consumed- Messages are sent to one or more subscriptions- Messages pulled from subscriptions by one or more competing consumers

- Benefits: - Temporal decoupling - Load leveling - Load balancing

Topics (and Subscriptions) Topics

Page 19: Driving the Azure Service Bus Scott Klueppel Solutions Architect SOAlutions, Inc. #jaxcodeimpact @kloopdogg

Client

Top

ic ServiceSub {color=red}

Sub {true} Service

Queues

Topics (with subscriptions)

Show me the messages

Client Queue Service

Page 20: Driving the Azure Service Bus Scott Klueppel Solutions Architect SOAlutions, Inc. #jaxcodeimpact @kloopdogg

Queues namespaceManager.CreateQueue("issues");

Topics namespaceManager.CreateTopic("telemetry-ingestion");

Subscriptions namespaceManager.CreateSubscription( "telemetry-ingestion", // topic name "Dashboard", // subscription name new SqlFilter("Color = 'red'")); // filter (optional)

Creating broker objects

Page 21: Driving the Azure Service Bus Scott Klueppel Solutions Architect SOAlutions, Inc. #jaxcodeimpact @kloopdogg

- Body (object or stream)- Properties (KVP)- Has two primary constructors: BrokeredMessage() - Empty body BrokeredMessage(object) - Object must be serializable (uses DataContractSerializer)

The BrokeredMessage class

Page 22: Driving the Azure Service Bus Scott Klueppel Solutions Architect SOAlutions, Inc. #jaxcodeimpact @kloopdogg

1.Poll using “Receive” operations (client API)

2.Use messaging bindings with a WCF service

Receiving Brokered Messages

Page 23: Driving the Azure Service Bus Scott Klueppel Solutions Architect SOAlutions, Inc. #jaxcodeimpact @kloopdogg

- Create a queue client- Send a message- Receive a message

Using queues Queues

TimeSpan receiveTimeout = TimeSpan.FromSeconds(5);while ((message = queueClient.Receive(receiveTimeout)) != null){ //TODO: Do work message.Complete();}

BrokeredMessage issueMsg = new BrokeredMessage(issue);queueClient.Send(issueMsg);

var uri = ServiceBusEnvironment.CreateServiceUri("sb", namespace, String.Empty);

TokenProvider credentials = TokenProvider.CreateSharedSecretTokenProvider(IssuerName, IssuerKey);

MessagingFactory factory = MessagingFactory.Create(uri, credentials); QueueClient queueClient = factory.CreateQueueClient("TestQueue");

Page 24: Driving the Azure Service Bus Scott Klueppel Solutions Architect SOAlutions, Inc. #jaxcodeimpact @kloopdogg

- Send a message- Receive a message

Using topics

MessagingFactory factory = MessagingFactory.Create(uri, credentials); SubscriptionClient subscriptionClient = factory.CreateSubscriptionClient(topicName, subscriptionName);TimeSpan receiveTimeout = TimeSpan.FromSeconds(5);

while ((message = subscriptionClient.Receive(receiveTimeout)) != null){ //TODO: Do work message.Complete();}

MessagingFactory factory = MessagingFactory.Create(uri, credentials);TopicClient topicClient = factory.CreateTopicClient(topicName);

BrokeredMessage issueMsg = new BrokeredMessage(issue);topicClient.Send(issueMsg);

Topics

Page 25: Driving the Azure Service Bus Scott Klueppel Solutions Architect SOAlutions, Inc. #jaxcodeimpact @kloopdogg

- Auto-forwarding topics and queues - Improves overall performance

Auto-forwarding

Client

Top

icTopicSubscripti

onSubscription Topic

TopicSubscription

SubscriptionSubscription

SubscriptionSubscription

SubscriptionSubscription

Au

to-f

orw

ard

ing

Scale out for more overall subscriptions

Queue

Topic

Au

to-f

orw

ard

ing

Fan in from several queues

Client

Client

Client Queue

Queue

Client

Top

icQueueSubscripti

onSubscription Queue

QueueSubscription

Au

to-f

orw

ard

ing

Forward to (maybe delayed) processing queues

Page 26: Driving the Azure Service Bus Scott Klueppel Solutions Architect SOAlutions, Inc. #jaxcodeimpact @kloopdogg

- Use SBMP over HTTP- Reuse clients → fewer connections- Client-side batching (async only)- Express queues/topics- Partitioning → distributed internal store

Squeezing Performance

Page 27: Driving the Azure Service Bus Scott Klueppel Solutions Architect SOAlutions, Inc. #jaxcodeimpact @kloopdogg

DemoQueues

Topics

Page 28: Driving the Azure Service Bus Scott Klueppel Solutions Architect SOAlutions, Inc. #jaxcodeimpact @kloopdogg

Patterns at WorkQueue-Based Load Leveling Priority Queues

Page 29: Driving the Azure Service Bus Scott Klueppel Solutions Architect SOAlutions, Inc. #jaxcodeimpact @kloopdogg

- Maximize availability- Increased scalability- Control costs

Queue-Based Load Leveling

Page 30: Driving the Azure Service Bus Scott Klueppel Solutions Architect SOAlutions, Inc. #jaxcodeimpact @kloopdogg

- Prioritization ofmessage processing

- Maximizeperformance

- Minimize operationalcosts

Priority Queue

Page 31: Driving the Azure Service Bus Scott Klueppel Solutions Architect SOAlutions, Inc. #jaxcodeimpact @kloopdogg

Cross-PlatformAMQPDevices

Page 32: Driving the Azure Service Bus Scott Klueppel Solutions Architect SOAlutions, Inc. #jaxcodeimpact @kloopdogg

Azure Service BusMultiple Protocol SupportService Bus Protocols- SBMP High performance .NET/Windows only

- HTTP Lower performance High reach

- AMQP High performance High reach

Page 33: Driving the Azure Service Bus Scott Klueppel Solutions Architect SOAlutions, Inc. #jaxcodeimpact @kloopdogg

Azure Service BusAMQP

- Enables cross-platform systems to be built using brokers and frameworks from different vendors

- Open, standard messaging protocol - OASIS AMQP 1.0 Standard (in progress since 2008, completed in 2013)

- Service Bus .NET Client Library (C#)- Apache Qpid JMS/IIT SwiftMQ (Java)- Apache Qpid Proton (C, PHP, Python)

Page 34: Driving the Azure Service Bus Scott Klueppel Solutions Architect SOAlutions, Inc. #jaxcodeimpact @kloopdogg

Azure Service BusUse Case: Sensors/Devices

ZigBee RadioSolar Cell(s)BatteriesSensors- Temperature- Moisture- Light- Sound

Coordinator

AMQP Ingestion / Analysis

Page 35: Driving the Azure Service Bus Scott Klueppel Solutions Architect SOAlutions, Inc. #jaxcodeimpact @kloopdogg

Azure Service BusEvent Hubs (Preview)

- Facilitates cloud-scale ingestion - Telemetry data - Events- Millions of events per second (up to 1 GB/s)

- Support for AMQP and HTTP 

- Each partition- 1MB/s ingress and 2MB/s egress- Needs exactly one dedicated worker

process

Page 36: Driving the Azure Service Bus Scott Klueppel Solutions Architect SOAlutions, Inc. #jaxcodeimpact @kloopdogg

DemoAMQP

Linux/Python

Page 37: Driving the Azure Service Bus Scott Klueppel Solutions Architect SOAlutions, Inc. #jaxcodeimpact @kloopdogg

What did we talk about?- Azure Service Bus Features- Some cloud design patterns- Cross-platform goodness

Page 38: Driving the Azure Service Bus Scott Klueppel Solutions Architect SOAlutions, Inc. #jaxcodeimpact @kloopdogg

code.orgProgramming for any age

Page 39: Driving the Azure Service Bus Scott Klueppel Solutions Architect SOAlutions, Inc. #jaxcodeimpact @kloopdogg

Questions?

#jaxcodeimpact

@kloopdogg

Scott KlueppelSolutions Architect

SOAlutions, Inc.

Page 40: Driving the Azure Service Bus Scott Klueppel Solutions Architect SOAlutions, Inc. #jaxcodeimpact @kloopdogg

References• Cloud Design Patterns (P&P)

http://msdn.microsoft.com/en-us/library/dn568099.aspx

• Apache Qpid Protonhttp://qpid.apache.org/proton/

Page 41: Driving the Azure Service Bus Scott Klueppel Solutions Architect SOAlutions, Inc. #jaxcodeimpact @kloopdogg

Thank you!

#jaxcodeimpact

@kloopdogg

Scott KlueppelSolutions Architect

SOAlutions, Inc.