Slide 1

Slide 1 text

No content

Slide 2

Slide 2 text

Agenda • What is the MessagingHub? • Messaging as a Service • Architecture • Conditions for reliability • Wrap-up

Slide 3

Slide 3 text

What is the MessagingHub? • MessagingHub is... • Functions • Born Background • Where is being used it? • Summary Indicators

Slide 4

Slide 4 text

MessagingHub is... An Independent and Universal All-in-one Messaging Platform A mechanism that operates on its own without being affected by other systems. A mechanism that can be used universally without any special difference anywhere. Meaning to take the necessary components within the MessagingHub project. I will focus on messaging. In order to meet the above requirements, it must be a platform.

Slide 5

Slide 5 text

MessagingHub is... Client Server MessagingHub Client Client Client Send a message from the server to the client

Slide 6

Slide 6 text

MessagingHub is... Client Server MessagingHub Client Client Client Send a message between clients

Slide 7

Slide 7 text

Functions Just like making a creation out of a toolbox. For example, there is a toolbox. Server Push App Push Email SMS Chatting

Slide 8

Slide 8 text

Functions Just like making a creation out of a toolbox. For example, there is a toolbox. Server Push App Push Email SMS Chatting

Slide 9

Slide 9 text

! Packets wasted System overload System Down Unnecessary traffic A fundamental structural improvement is needed! Born Background Client Server Periodically Polling DB In a situation where most polling responses result in a meaningless call "no change", What if the number of clients increases sharply? " # $ ☠

Slide 10

Slide 10 text

Push Trigger Event Client Server DB ! Packets wasted System overload System Down Unnecessary traffic Polling Push MessagingHub Born Background

Slide 11

Slide 11 text

Complexity How to pay off technical debt Productivity Improve little by little with maintenance. ᶄ ᶅ ᶃ Completely new from scratch. Turn it into a fundamental technology.

Slide 12

Slide 12 text

For universal use, Delegate roles easily through loose coupling. For operating independently, No business domain knowledge. Turn it into a fundamental technology For delivering the message, Send messages from source to destination.

Slide 13

Slide 13 text

Where is being used it? Delivery Merchant CS Retail User The fundamental tech. for Demae-can, the No.1 food delivery service in JPN. MessagingHub

Slide 14

Slide 14 text

Summary Indicators Send Message 1.5M+ Server Push Processing Time 150ms Daily Concurrent Peak Connection 50K+

Slide 15

Slide 15 text

M a a S • The reason to be a platform • Conditions to become a platform essaging s ervice

Slide 16

Slide 16 text

The reason to be a platform Maintenance Communication Stability System Fault Legacy Debt Error Common Case Duplicate Needs Spaghetti Code Product Cross Concern Difficult Handling Problem Domains

Slide 17

Slide 17 text

The reason to be a platform Common Case Duplicate Needs Spaghetti Code Product Cross Concern Difficult Handling Problem Domains Maintenance Communication Stability System Fault Legacy Debt Error

Slide 18

Slide 18 text

The reason to be a platform Maintenance Communication Stability System Fault Legacy Debt Error Common Case Duplicate Needs Spaghetti Code Product Cross Concern Difficult Handling Problem Domains

Slide 19

Slide 19 text

The reason to be a platform Maintenance Communication Stability System Fault Legacy Debt Error Product Cross Concern Difficult Handling Problem Domains Common Case Duplicate Needs Spaghetti Code

Slide 20

Slide 20 text

The reason to be a platform MessagingHub It must be a platform It doesn't have to be a platform For specific domain N : 1 1 : 1

Slide 21

Slide 21 text

The reason to be a platform MessagingHub It must be a platform It doesn't have to be a platform For specific domain N : 1 1 : 1

Slide 22

Slide 22 text

The reason to be a platform A) Delegate! Focus on your business MessagingHub Q) Do you need a messaging?

Slide 23

Slide 23 text

Can & Can't Conditions to become a platform Can do It is focused on messaging O Send to message from source to destination. O Send to various notification channels. O Communicate with clients. O We are tracking sending messages history. O Messages sending strategy. Can't do Do not engage in domain knowledge X It is not dependent on a specific domain. X It should not know the detailed business logic of the specific domain.

Slide 24

Slide 24 text

I don't know who you are. Conditions to become a platform MessagingHub 1. Request Connection Token 5. Response Connection Token 6. CONNECT with Connection Token 2. Request Token 4. Response Token 3. Token Generating Client Server

Slide 25

Slide 25 text

I don't know who you are. Conditions to become a platform The user id is known to the external-system. A type defined by messaging-hub. It is an array for sending the same message to multiple targets. It is like a message type or action. It should be "stringify JSON". MessagingHub doesn't care about payload and bypasses it. If the app-client is not connected to the WebSocket, it sends the app-push (a.k.a. FCM) with this data. If you want to turn off the app-push, you can turn it off. This is a message-sending strategy parameter. If the message-router does not consume the sent message to MessagingHub within the specified time, it is ignored.

Slide 26

Slide 26 text

Conditions to become a platform I don't know who you are. Any Server Any Client Because it is independent and universal. But I don't care.

Slide 27

Slide 27 text

Architecture • Overview • Modules • Flow • Generalization • Infra

Slide 28

Slide 28 text

$POTVM 4.4 '$. &NBJM /PUJpDBUJPOT ŋŋŋ Overview message-router connection-manager chat-app ack-receiver message-app operation-app consumer-proxy notification-app operation redis ack message notification &MBTUJDTFBSDI (SBGBOB 1SPNFUIFVT , ,JCBOB BENJOJTUSBUPS *OqVY%# 'MVFOUE Client Server Server Server ,BGLB chat

Slide 29

Slide 29 text

4.4 '$. &NBJM /PUJpDBUJPOT ŋŋŋ consumer-proxy notification-app notification Server $POTVM message-router message-router connection-manager chat-app ack-receiver message-app operation-app operation redis ack message &MBTUJDTFBSDI (SBGBOB 1SPNFUIFVT , ,JCBOB BENJOJTUSBUPS *OqVY%# 'MVFOUE Client Server Server ,BGLB chat message-router Server redis message sourcing and routing It receives messages from an external interworking system and appropriately routes them according to business requirements. ,BGLB

Slide 30

Slide 30 text

4.4 '$. &NBJM /PUJpDBUJPOT ŋŋŋ consumer-proxy notification-app notification Server $POTVM connection-manager message-router connection-manager chat-app ack-receiver message-app operation-app operation redis ack message &MBTUJDTFBSDI (SBGBOB 1SPNFUIFVT , ,JCBOB BENJOJTUSBUPS *OqVY%# 'MVFOUE Client Server Server ,BGLB chat Client connection-manager redis connection management and server push It manages WebSocket connections connected to clients and handles server pushes. ,BGLB Server

Slide 31

Slide 31 text

4.4 '$. &NBJM /PUJpDBUJPOT ŋŋŋ consumer-proxy notification-app notification Server $POTVM notification-app message-router connection-manager chat-app ack-receiver message-app operation-app operation redis ack message &MBTUJDTFBSDI (SBGBOB 1SPNFUIFVT , ,JCBOB BENJOJTUSBUPS *OqVY%# 'MVFOUE Client Server Server ,BGLB chat various third-party notification channel It delivers messages to the third-party notification channel, except for server push. 4.4 '$. &NBJM /PUJpDBUJPOT ŋŋŋ notification Server notification-app

Slide 32

Slide 32 text

4.4 '$. &NBJM /PUJpDBUJPOT ŋŋŋ consumer-proxy notification-app notification Server $POTVM message-app message-router connection-manager chat-app ack-receiver message-app operation-app operation redis ack message &MBTUJDTFBSDI (SBGBOB 1SPNFUIFVT , ,JCBOB BENJOJTUSBUPS *OqVY%# 'MVFOUE Client Server Server ,BGLB chat message data management It manages the message data sent by the interworking server to the client. Management items also include information on the delivery results. message-app message Server

Slide 33

Slide 33 text

4.4 '$. &NBJM /PUJpDBUJPOT ŋŋŋ consumer-proxy notification-app notification Server $POTVM ack-receiver message-router connection-manager chat-app ack-receiver message-app operation-app operation redis ack message &MBTUJDTFBSDI (SBGBOB 1SPNFUIFVT , ,JCBOB BENJOJTUSBUPS *OqVY%# 'MVFOUE Client Server Server ,BGLB chat message acknowledgment receiver The purpose of the ack-receiver is to receive a message reception callback from the client to know whether the message has been safely delivered to the client. ack-receiver ack Client

Slide 34

Slide 34 text

4.4 '$. &NBJM /PUJpDBUJPOT ŋŋŋ consumer-proxy notification-app notification Server $POTVM consumer-proxy message-router connection-manager chat-app ack-receiver message-app operation-app operation redis ack message &MBTUJDTFBSDI (SBGBOB 1SPNFUIFVT , ,JCBOB BENJOJTUSBUPS *OqVY%# 'MVFOUE Client Server Server ,BGLB chat Kafka consumer-client layer It was added to separate Kafka's consumer clients into a separate layer. Benefits - 1) Resolving consumer rebalancing issues. 2) Eliminate the limitations of scale-out. ,BGLB consumer-proxy

Slide 35

Slide 35 text

4.4 '$. &NBJM /PUJpDBUJPOT ŋŋŋ consumer-proxy notification-app notification Server $POTVM chat-app message-router connection-manager chat-app ack-receiver message-app operation-app operation redis ack message &MBTUJDTFBSDI (SBGBOB 1SPNFUIFVT , ,JCBOB BENJOJTUSBUPS *OqVY%# 'MVFOUE Client Server Server ,BGLB chat chatting business logic It processes the chat business logic and manages the data. chat-app chat

Slide 36

Slide 36 text

4.4 '$. &NBJM /PUJpDBUJPOT ŋŋŋ consumer-proxy notification-app notification Server $POTVM operation-app message-router connection-manager chat-app ack-receiver message-app operation-app operation redis ack message &MBTUJDTFBSDI (SBGBOB 1SPNFUIFVT , ,JCBOB BENJOJTUSBUPS *OqVY%# 'MVFOUE Client Server Server ,BGLB chat operation It is a role for registering and processing schedulers related to service operations. operation-app operation ,BGLB

Slide 37

Slide 37 text

4.4 '$. &NBJM /PUJpDBUJPOT ŋŋŋ consumer-proxy notification-app notification Server $POTVM third-party solutions message-router connection-manager chat-app ack-receiver message-app operation-app operation redis ack message &MBTUJDTFBSDI (SBGBOB 1SPNFUIFVT , ,JCBOB BENJOJTUSBUPS *OqVY%# 'MVFOUE Client Server Server ,BGLB chat Monitoring & Alert & etc $POTVM &MBTUJDTFBSDI (SBGBOB 1SPNFUIFVT , ,JCBOB BENJOJTUSBUPS *OqVY%# 'MVFOUE

Slide 38

Slide 38 text

Libraries MessagingHub Modules common core messaging-shared external-lib Avro IDL Protocol Buffers IDL Specific for messaging Boilerplate External System Protocol Buffers IDL for sharing

Slide 39

Slide 39 text

Libraries Controller Aspect Common Response Format Minimum Support Version Custom Header Logging Factory Log Annotation Security API MySQL with JPA Kafka with Avro Redis gRPC Builder Common Log Format Log Filter for security Append Custom Log Default Common Log Setup TimeChecker Logging AtomicTask InternalAPI Security Config Token Generation Token Validation Metrics Micrometer Consul Watcher Common ErrorCode Environment Payload Utility Config RestClient Retry DateTime Mapper SystemInfo Yaml Loader RestTemplate ThreadPool ObjectMapper

Slide 40

Slide 40 text

Message Flow message-router connection-manager ack-receiver notification-app message-app 1. send message(sourcing) 3. message uuid issued 7.1 push message by socket 8. message acknowledgement 7.2. send message by notification channels 5.1 route message 5.3 produce message if client disconnected 4. consume 5.2 route message 2. produce 6. consume update message sending status check the message with the message uuid if desired Client Server ,BGLB

Slide 41

Slide 41 text

Message Flow message-router connection-manager ack-receiver notification-app message-app 1. send message(sourcing) 3. message uuid issued 7.1 push message by socket 8. message acknowledgement 7.2. send message by notification channels 5.1 route message 5.3 produce message if client disconnected 4. consume 5.2 route message 2. produce 6. consume update message sending status check the message with the message uuid if desired Client Server ,BGLB message-router 3. message uuid issued 5.1 route message 4. consume 5.2 route message 2. produce Server 1. send message(sourcing) 6. consume ,BGLB

Slide 42

Slide 42 text

Message Flow message-router connection-manager ack-receiver notification-app message-app 1. send message(sourcing) 3. message uuid issued 7.1 push message by socket 8. message acknowledgement 7.2. send message by notification channels 5.1 route message 5.3 produce message if client disconnected 4. consume 5.2 route message 2. produce 6. consume update message sending status check the message with the message uuid if desired Client Server ,BGLB connection-manager notification-app 7.1 push message by socket 5.3 produce message if client disconnected Client ,BGLB 7.2. send message by notification channels 6. consume

Slide 43

Slide 43 text

Message Flow message-router connection-manager ack-receiver notification-app message-app 1. send message(sourcing) 3. message uuid issued 7.1 push message by socket 8. message acknowledgement 7.2. send message by notification channels 5.1 route message 5.3 produce message if client disconnected 4. consume 5.2 route message 2. produce 6. consume update message sending status check the message with the message uuid if desired Client Server ,BGLB ack-receiver message-app 8. message acknowledgement check the message with the message uuid if desired Client Server update message sending status

Slide 44

Slide 44 text

Notification Flow FCM SMS Email Another Notifications ŋŋŋ message notification message-router notification-app message-app message sourcing Server ,BGLB necessary information

Slide 45

Slide 45 text

Chat Flow chat-app chat Client A Client B connection-manager

Slide 46

Slide 46 text

Specific Needs in Food Delivery Think about chatting between drivers and users Who makes the chat room? How to automatically delete chat rooms? How do you allow input to be selected?

Slide 47

Slide 47 text

Chat Flow message-router chat-app notification-app chat $POTVM Server Client A Client B ,BGLB connection-manager

Slide 48

Slide 48 text

Chat Usecase Specific Usecase Common Usecase SYSTEM_UPDATE_CHAT_USER SYSTEM_CREATE_DIRECT_CHAT_ROOM SYSTEM_SEND_CHAT_LOG SYSTEM_DISABLE_CHAT_ROOM SYSTEM_DELETE_CHAT_ROOM UPDATE_CHAT_USER CONNECT GET_CHAT_ROOMS MARK_CHAT_READ HAS_DIRECT_CHAT_ROOM CREATE_DIRECT_CHAT_ROOM GET_CHAT_ROOM GET_CHAT_LOGS SEND_CHAT_LOG RECEIVE_CHAT_READ RECEIVE_CHAT_LOG MARK_CHAT_READ RECEIVE_CHAT_READ SET_CHAT_ROOM_NAME SET_CHAT_ROOM_PUSH SET_CHAT_ROOM_IMAGE DELETE_CHAT_ROOM GET_CHAT_MEMBER GET_CHAT_MEMBERS GET_CHAT_LOG_MANAGED_GROUP_NAMES GET_CHAT_LOG_MANAGED_GROUP Receiver has new setting delete member chat log Generalization

Slide 49

Slide 49 text

Generalization Specific Usecase Common Usecase SYSTEM_UPDATE_CHAT_USER SYSTEM_CREATE_DIRECT_CHAT_ROOM SYSTEM_SEND_CHAT_LOG SYSTEM_DISABLE_CHAT_ROOM SYSTEM_DELETE_CHAT_ROOM UPDATE_CHAT_USER CONNECT GET_CHAT_ROOMS MARK_CHAT_READ HAS_DIRECT_CHAT_ROOM CREATE_DIRECT_CHAT_ROOM GET_CHAT_ROOM GET_CHAT_LOGS SEND_CHAT_LOG RECEIVE_CHAT_READ RECEIVE_CHAT_LOG MARK_CHAT_READ RECEIVE_CHAT_READ SET_CHAT_ROOM_NAME SET_CHAT_ROOM_PUSH SET_CHAT_ROOM_IMAGE DELETE_CHAT_ROOM GET_CHAT_MEMBER GET_CHAT_MEMBERS GET_CHAT_LOG_MANAGED_GROUP_NAMES GET_CHAT_LOG_MANAGED_GROUP Receiver has new setting delete member chat log Generalization Generalization is a way to extend universality without compromising independence.

Slide 50

Slide 50 text

Infra

Slide 51

Slide 51 text

Conditions for reliability • Connection Management • Message Acknowledgement • Connection Confirmation • How to get missing messages?

Slide 52

Slide 52 text

Connection Management internal socket server internal socket client message sourcing message routing Host event operation-app message-router Storage connection-manager bootstrap Initializer handler codec messaging-shared connection meta internal connection scheduler channel kafka bootstrap Initializer handler codec messaging-shared channel internal connection connection meta kafka scheduler bootstrap Initializer handler codec Client ,BGLB websocket server

Slide 53

Slide 53 text

Connection Management internal socket server internal socket client message sourcing message routing Host event operation-app message-router Storage connection-manager bootstrap Initializer handler codec messaging-shared connection meta internal connection scheduler channel kafka bootstrap Initializer handler codec messaging-shared channel internal connection connection meta kafka scheduler bootstrap Initializer handler codec Client ,BGLB websocket server message-router Storage connection-manager connection meta connection meta websocket server internal socket server internal socket client

Slide 54

Slide 54 text

Connection Management internal socket server internal socket client message sourcing message routing Host event operation-app message-router Storage connection-manager bootstrap Initializer handler codec messaging-shared connection meta internal connection scheduler channel kafka bootstrap Initializer handler codec messaging-shared channel internal connection connection meta kafka scheduler bootstrap Initializer handler codec Client ,BGLB websocket server internal socket server internal socket client Host event operation-app message-router connection-manager connection meta connection meta ,BGLB Storage

Slide 55

Slide 55 text

Include ack authorization Include ack authorization Message Acknowledgement notification-app connection-manager chat-app ack-receiver messaging-shared MessagingHub ack Client App Push Chat Server Push

Slide 56

Slide 56 text

Connection Confirmation MessagingHub External System Send OK, But NO. ᶄ ᶅ ᶆ ᶇ ᶈ Network Client ᶃ

Slide 57

Slide 57 text

Connection Confirmation MessagingHub PING PONG_ACK PONG ᶃ Periodically send a ping. ᶄ Receive Pong. If there is no response within a specific time, the connection is terminated. If the client does not receive the server PONG_ACK within a specific time, it is good to try to reconnect. ᶅ Client

Slide 58

Slide 58 text

Client Still, there must be a way to send it NO connection OFF app push OFFLINE temporarily A push message can also be sent when the user agent is temporarily offline. In support of this, the push service stores messages for the user agent until the user agent becomes available. Q. How to get missing messages? A.

Slide 59

Slide 59 text

How to get missing messages? Client message-app RECENT_MESSAGES message-router connection-manager notification-app message chat-app chat

Slide 60

Slide 60 text

Wrap-up • Next Plan • Tech Blog

Slide 61

Slide 61 text

Next Plan Stability Optimizing Advancement Observability Efficiency More Simple, More Powerful! Widen the usage point Reliability &

Slide 62

Slide 62 text

Tech Blog Until you take the first steps to pay off your technical debt Take a look at the messaging system (a.k.a MessagingHub) MessagingHub troubleshooting https://engineering.linecorp.com/ko/blog/about-messaging-hub-1 https://engineering.linecorp.com/ko/blog/about-messaging-hub-2 https://engineering.linecorp.com/ko/blog/messaing-hub-troubleshooting

Slide 63

Slide 63 text

՘ऴΘΓ The End