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

Post on 26-Dec-2015

213 Views

Category:

Documents

1 Downloads

Preview:

Click to see full reader

Transcript

Driving theAzure Service Bus

Scott KlueppelSolutions 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

Azure Service BusFeature OverviewManagement PortalTools

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

Azure Service BusWhat is the Service Bus?

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

DemoManagement Portal

Tools

Relayed MessagingFeaturesDemo

-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

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

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

Fire

wall

NAT

NAT

Fire

wall

Corporate

RelaysScenario 2: Emergency Use

Client

On-Premise

Web App

Other ServiceRela

y

WCF Service

WCF Service

Fire

wall

NAT

NAT

Fire

wall

Corporate .

RelaysScenario 3: Roaming Devices

Client

On-Premise

Web App

Other Service

Coffee Shop . Client

Relay

WCF Service

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

DemoConvert to Relay

Load balancing

Brokered MessagingFeaturesDemos

- 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?

- 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

- 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

Client

Top

ic ServiceSub {color=red}

Sub {true} Service

Queues

Topics (with subscriptions)

Show me the messages

Client Queue Service

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

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

The BrokeredMessage class

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

2.Use messaging bindings with a WCF service

Receiving Brokered Messages

- 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");

- 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

- 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

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

Squeezing Performance

DemoQueues

Topics

Patterns at WorkQueue-Based Load Leveling Priority Queues

- Maximize availability- Increased scalability- Control costs

Queue-Based Load Leveling

- Prioritization ofmessage processing

- Maximizeperformance

- Minimize operationalcosts

Priority Queue

Cross-PlatformAMQPDevices

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

- HTTP Lower performance High reach

- AMQP High performance High reach

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)

Azure Service BusUse Case: Sensors/Devices

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

Coordinator

AMQP Ingestion / Analysis

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

DemoAMQP

Linux/Python

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

code.orgProgramming for any age

Questions?

#jaxcodeimpact

@kloopdogg

Scott KlueppelSolutions Architect

SOAlutions, Inc.

References• Cloud Design Patterns (P&P)

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

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

Thank you!

#jaxcodeimpact

@kloopdogg

Scott KlueppelSolutions Architect

SOAlutions, Inc.

top related