/'
  Licensed to the Apache Software Foundation (ASF) under one or more
  contributor license agreements.  See the NOTICE file distributed with
  this work for additional information regarding copyright ownership.
  The ASF licenses this file to You under the Apache License, Version 2.0
  (the "License"); you may not use this file except in compliance with
  the License.  You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
'/

@startuml
'https://plantuml.com/sequence-diagram

autonumber
actor Alice as alice
participant MessagingService as aliceMessageService
participant "ScaleCube inbound \n DirectProcessor (Alice)" as aliceInbound
participant "Executor \n alice-client-worker" as aliceWorker
entity Socket as sock
participant "Executor \n bob-srv-worker" as bobWorker
participant "ScaleCube inbound \n DirectProcessor (Bob)" as bobInbound
actor Bob as bob

alice -> aliceMessageService : Message

aliceMessageService -> aliceWorker : Submit to netty \n worker thread
activate aliceWorker #Green

aliceWorker -> sock : Write and flush \n message data to socket
deactivate aliceWorker

sock -> bobWorker : Read from socket
activate bobWorker #Green

bobWorker --> bobInbound : Previous messages
bobWorker -> bobInbound
deactivate bobWorker
activate bobInbound #Green

bobInbound --> bob : Previous messages

bobInbound -> bob : Message from Alice
deactivate bobInbound

bob -> bobWorker : Response from Bob
activate bobWorker #Green

bobWorker -> sock : Write and flush \n message data to socket
deactivate bobWorker

sock -> aliceWorker : Read from socket
activate aliceWorker #Green

aliceWorker --> aliceInbound : Previous messages
aliceWorker -> aliceInbound : Response from Bob
deactivate aliceWorker
activate aliceInbound #Green

aliceInbound --> aliceMessageService : Previous messages
aliceInbound -> aliceMessageService : Response from Bob
deactivate aliceInbound

aliceMessageService -> alice : Response from Bob

@enduml
