+ All Categories
Home > Documents > THE EVENT-DRIVEN UI - Cloud Native Computing Foundation · •Kafka as the de-facto standard for...

THE EVENT-DRIVEN UI - Cloud Native Computing Foundation · •Kafka as the de-facto standard for...

Date post: 20-May-2020
Category:
Upload: others
View: 6 times
Download: 0 times
Share this document with a friend
27
THE EVENT-DRIVEN UI BRIDGING THE GAP KEVIN BADER
Transcript
Page 1: THE EVENT-DRIVEN UI - Cloud Native Computing Foundation · •Kafka as the de-facto standard for implementing event-driven architecture: • Confluent Kafka platform • Confluent

THEEVENT-DRIVEN UIBRIDGING THE GAP

KEVIN BADER

Page 2: THE EVENT-DRIVEN UI - Cloud Native Computing Foundation · •Kafka as the de-facto standard for implementing event-driven architecture: • Confluent Kafka platform • Confluent

• Situation• Vision• Challenges• Solution• Conclusion

AGENDA

Page 3: THE EVENT-DRIVEN UI - Cloud Native Computing Foundation · •Kafka as the de-facto standard for implementing event-driven architecture: • Confluent Kafka platform • Confluent

One backend, one frontend:one source of data and events.

SITUATION

Copyright © 2019 Accenture. All rights reserved. 3

This doeseverything

Page 4: THE EVENT-DRIVEN UI - Cloud Native Computing Foundation · •Kafka as the de-facto standard for implementing event-driven architecture: • Confluent Kafka platform • Confluent

Copyright © 2019 Accenture. All rights reserved. 4

Microservices group functionalityby domain/context.Events decouple microservices.

Still only one frontend.

SITUATION

AuthenticationContext

Customer ProfileContext

subscribes

Publishes

profile related

events

Publishes

session related

events

How can we

subscribe

to those events

here?

Page 5: THE EVENT-DRIVEN UI - Cloud Native Computing Foundation · •Kafka as the de-facto standard for implementing event-driven architecture: • Confluent Kafka platform • Confluent

Copyright © 2019 Accenture. All rights reserved. 5

VISION: AN EVENT-DRIVEN WORLD

Microservices emit events.Frontends consume and produce events the same way other microservices do.Only open standards.Frontends not aware how events are stored.

Page 6: THE EVENT-DRIVEN UI - Cloud Native Computing Foundation · •Kafka as the de-facto standard for implementing event-driven architecture: • Confluent Kafka platform • Confluent

Copyright © 2019 Accenture. All rights reserved. 6

Microservices should• not handle long-lived connections• not publish “special” events for

frontend consumptionFrontends should• be agnostic of event partitioning on

the backend• not rely on proprietary formats• be able to publish events• be able to control what events they

are subscribed to

VISION: GOALS

AuthenticationContext

Customer ProfileContext

subscribes

Publishes

profile related

events

Publishes

session related

events

How can we

subscribe

to those events

here?

Backend

Page 7: THE EVENT-DRIVEN UI - Cloud Native Computing Foundation · •Kafka as the de-facto standard for implementing event-driven architecture: • Confluent Kafka platform • Confluent

1. Scaling out: number of users, rate of events2. Event sources3. Synchronous request, asynchronous processing4. Authorization

CHALLENGES

Copyright © 2019 Accenture. All rights reserved. 7

Page 8: THE EVENT-DRIVEN UI - Cloud Native Computing Foundation · •Kafka as the de-facto standard for implementing event-driven architecture: • Confluent Kafka platform • Confluent

Copyright © 2019 Accenture. All rights reserved. 8

1. SCALING OUT

eventsgrouped byevent type

eventsgrouped bypartition,e.g. user ID

route eventsto frontends

load balancer

frontends

event topics/partitions

ß the solution

frontendssubscribeto events

• Many users, few online

• Events from allmicroservices

Page 9: THE EVENT-DRIVEN UI - Cloud Native Computing Foundation · •Kafka as the de-facto standard for implementing event-driven architecture: • Confluent Kafka platform • Confluent

• Kafka as the de-facto standard for implementing event-driven architecture:

• Confluent Kafka platform

• Confluent Cloud on GCP

• Azure Event Hubs has Kafka-compatible API

• Amazon Managed Streaming for Kafka (MSK)

• Publish via HTTP• Easier to setup and use during dev and test

• Used when decrypting data on-the-fly

2. EVENT SOURCES

Copyright © 2019 Accenture. All rights reserved. 9

Page 10: THE EVENT-DRIVEN UI - Cloud Native Computing Foundation · •Kafka as the de-facto standard for implementing event-driven architecture: • Confluent Kafka platform • Confluent

• Asynchronous, event-driven processing is the new default

• Decoupling: easy to add/remove microservices

• Deployment: easy to deal with upgrades/rollbacks/downtime

• But: frontend and 3rd party clients often expect immediate response

• Requires “conversion” of asynchronously processed result into synchronous request-response

3. SYNC REQUEST, ASYNC PROCESSING

Copyright © 2019 Accenture. All rights reserved. 10

Page 11: THE EVENT-DRIVEN UI - Cloud Native Computing Foundation · •Kafka as the de-facto standard for implementing event-driven architecture: • Confluent Kafka platform • Confluent

• Is ESSENTIAL: any event may be subscribed to• As little business logic at possible• As pluggable as possible

4. AUTHORIZATION

Copyright © 2019 Accenture. All rights reserved. 11

Page 12: THE EVENT-DRIVEN UI - Cloud Native Computing Foundation · •Kafka as the de-facto standard for implementing event-driven architecture: • Confluent Kafka platform • Confluent

Copyright © 2019 Accenture. All rights reserved. 12

CANDIDATE: ASP.NET SignalR

https://azure.microsoft.com/en-us/services/signalr-service/

Page 13: THE EVENT-DRIVEN UI - Cloud Native Computing Foundation · •Kafka as the de-facto standard for implementing event-driven architecture: • Confluent Kafka platform • Confluent

Copyright © 2019 Accenture. All rights reserved. 13

CANDIDATE: ASP.NET SignalR

https://azure.microsoft.com/en-us/services/signalr-service/

Page 14: THE EVENT-DRIVEN UI - Cloud Native Computing Foundation · •Kafka as the de-facto standard for implementing event-driven architecture: • Confluent Kafka platform • Confluent

Copyright © 2019 Accenture. All rights reserved. 14

Microservices should• not handle long-lived connections• not publish “special” events for

frontend consumptionFrontends should• be agnostic of event partitioning on

the backend• not rely on proprietary formats• be able to publish events• be able to control what events they

are subscribed to

CANDIDATE: ASP.NET SignalR

✓✘

✓✓

✘✘

Page 15: THE EVENT-DRIVEN UI - Cloud Native Computing Foundation · •Kafka as the de-facto standard for implementing event-driven architecture: • Confluent Kafka platform • Confluent

Copyright © 2019 Accenture. All rights reserved. 15

CANDIDATE: Pushpin

Pushpin has no built-in support for connecting tospecific queues/brokers. Instead, you can write a small worker program that runs alongside Pushpin, toreceive from the queue and send to Pushpin. Oftenyou’ll need to transform the data as well, and you canwrite any data transformation code in the same worker program.

https://pushpin.org/docs/about/

Page 16: THE EVENT-DRIVEN UI - Cloud Native Computing Foundation · •Kafka as the de-facto standard for implementing event-driven architecture: • Confluent Kafka platform • Confluent

Copyright © 2019 Accenture. All rights reserved. 16

Microservices should• not handle long-lived connections• not publish “special” events for

frontend consumptionFrontends should• be agnostic of event partitioning on

the backend• not rely on proprietary formats• be able to publish events• be able to control what events they

are subscribed to

CANDIDATE: Pushpin

✓✘

✓✓

✘✘

Page 17: THE EVENT-DRIVEN UI - Cloud Native Computing Foundation · •Kafka as the de-facto standard for implementing event-driven architecture: • Confluent Kafka platform • Confluent

Copyright © 2019 Accenture. All rights reserved. 17

SOLUTION: Reactive Interaction Gateway

Page 18: THE EVENT-DRIVEN UI - Cloud Native Computing Foundation · •Kafka as the de-facto standard for implementing event-driven architecture: • Confluent Kafka platform • Confluent

Copyright © 2019 Accenture. All rights reserved. 18

Microservices should• not handle long-lived connections• not publish “special” events for

frontend consumptionFrontends should• be agnostic of event partitioning on

the backend• not rely on proprietary formats• be able to publish events• be able to control what events they

are subscribed to

SOLUTION: Reactive Interaction Gateway

✓✓

✓✓

✓✓

Page 19: THE EVENT-DRIVEN UI - Cloud Native Computing Foundation · •Kafka as the de-facto standard for implementing event-driven architecture: • Confluent Kafka platform • Confluent

Copyright © 2019 Accenture. All rights reserved. 19

1. SCALING OUT

K8s Service

Consumer Group

Apache Kafka

Amazon Kinesis

Kafka partitions / Kinesis shards

Server-Sent Events (HTTP/2)

WebSocket (HTTP/1.1)

K8s headless service

for peer discovery

SSE connection

Event-Filter

Kafka Consumer

attaches to forwards subscribed events

subscribes to forward subscribed events

forward eventsgrouped by event type

event filters and subscriptionsreplicated among nodes

events are routed to sessionprocesses from all nodesSession

Node

Page 20: THE EVENT-DRIVEN UI - Cloud Native Computing Foundation · •Kafka as the de-facto standard for implementing event-driven architecture: • Confluent Kafka platform • Confluent

Copyright © 2019 Accenture. All rights reserved. 20

2. EVENT SOURCES

Page 21: THE EVENT-DRIVEN UI - Cloud Native Computing Foundation · •Kafka as the de-facto standard for implementing event-driven architecture: • Confluent Kafka platform • Confluent

Copyright © 2019 Accenture. All rights reserved. 21

3. SYNC REQUEST, ASYNC PROCESSING

HTTP POST

produce request event

pick up request event

process request

publish response

publish response

HTTP response

frontend message broker backend service

the frontend seesa traditional API

while processing isactually

asynchronous

Page 22: THE EVENT-DRIVEN UI - Cloud Native Computing Foundation · •Kafka as the de-facto standard for implementing event-driven architecture: • Confluent Kafka platform • Confluent

Copyright © 2019 Accenture. All rights reserved. 22

4. AUTHORIZATION

subscribe to events

forward published event

Alice authorization service

is Alice allowedto subscribe to

those event types?

yes

Bob

publish event

is Bob allowedto publish this event?

yes

subscribing to eventspublishing events

authorized by

JWT validation orcalling a service

Page 23: THE EVENT-DRIVEN UI - Cloud Native Computing Foundation · •Kafka as the de-facto standard for implementing event-driven architecture: • Confluent Kafka platform • Confluent

• Free Software, Apache 2.0 License, developed on GitHub

• Open standards:– CloudEvents (CNCF Sandbox project)– HTTP/1.1 and HTTP/2– Server-Sent Events (SSE)– WebSocket– Kafka

Reactive Interaction Gateway

Copyright © 2019 Accenture. All rights reserved. 23

Page 24: THE EVENT-DRIVEN UI - Cloud Native Computing Foundation · •Kafka as the de-facto standard for implementing event-driven architecture: • Confluent Kafka platform • Confluent

• No external dependencies• Configuration using environment variables• Available on Docker Hub

$ docker pull accenture/reactive-interaction-gateway

• Scales like a stateless service$ kubectl scale deployment rig --replicas=10

Reactive Interaction Gateway

Copyright © 2019 Accenture. All rights reserved. 24

Page 25: THE EVENT-DRIVEN UI - Cloud Native Computing Foundation · •Kafka as the de-facto standard for implementing event-driven architecture: • Confluent Kafka platform • Confluent

• Real-time UI for great user experience• Extending event-driven architecture to the

frontend decouples frontend and backend• The Reactive Interaction Gateway enables

this in a scalable way, using open standards

CONCLUSION

Copyright © 2019 Accenture. All rights reserved. 25

Page 26: THE EVENT-DRIVEN UI - Cloud Native Computing Foundation · •Kafka as the de-facto standard for implementing event-driven architecture: • Confluent Kafka platform • Confluent

Copyright © 2019 Accenture. All rights reserved. 26

GitHub: kevinbaderTwitter: @KevnBadr

Check out the Reactive Interaction Gateway and let us know what you think!

github.com/Accenture/reactive-interaction-gateway

Thanks to:• Dominik Wagenknecht <- inventor• Mario Macai <- long-term core team member• Accenture’s Software Innovation team

Page 27: THE EVENT-DRIVEN UI - Cloud Native Computing Foundation · •Kafka as the de-facto standard for implementing event-driven architecture: • Confluent Kafka platform • Confluent

• Duplicate events• Lost events• Out-of-order events

APPLICATION-LEVEL CONCERNS

Copyright © 2019 Accenture. All rights reserved. 27


Recommended