# SOLACE PubSub+ ###### tags: `learning` ## Introduction - 整合跨廠、Data center、Cloud Server及IoT,作為設備之間即時通訊的管理平台 1. Event Management - 支援EDA (Event-Driven Architecture) - 偵測特定Event 2. Event Streaming - 建立Event mesh以共享數據 - Event Mesh是一個由事件代理系統(Event Broker)所組成的網路架構層,可以將某應用程式產生的event動態route到其他應用程式(無論他部屬在哪裡) - Event Broker - 接收從Producers產生的事件訊息,並將事件訊息route給事件訂閱者(Consumers) - Event Broker可以部屬在 1. Cloud (包含公有雲&私有雲,etc) 2. Software (各類Container或虛擬機管理平台) 3. Appliance - 名詞解釋 3. Monitor System health & performance - "+" 表示支援除了Publish/Subscribe之外的訊息交換模式 1. Request/Reply (Send/Receive) - 兩個P2P通道 3. P2P 4. Streaming 5. Caching & Replay ## [Topic](https://docs.solace.com/Messaging/Topic-Architecture-Best-Practices.htm#topic-bp-definitions) - 可以想成一個規則,可以定義接收哪些producer的哪些event message $\Rightarrow$ topic是consumer(subscriber)的訂閱單位 - 分成publish topics及subscribe topics - [SMF(Solace Message Format)](https://docs.solace.com/Messaging/SMF-Topics.htm) - Syntax: `a/b/c/.../n` (用LEVEL分類) - eg. `animals/domestic/cats` - Case-Sensitive - 萬用字元(for subscribe topic): `*`, `>`: 放在最後一個LEVEL, `!`: except - eg. `animals/*/cats/>` matches the topics `animals/domestic/cats/persian`& `animals/wild/cats/leopard` ## Message Deliver Mode: 1. Direct Message - Client直接訂閱Topic - Client必須connect event broker才收的到訊息(訊息不會保留) - 通道壅塞時容易掉包 3. Garanteed Message - Event Broker會向producer acknowledge收到的訊息 (by acknowledge receipt) - Event Broker會將收到的訊息保存在一個Message storage (一個event broker的endpoint) - Event Broker會確保Client收到訊息, 並在收到acknowledge receipt之後將它從Message storage刪除 - Endpoint types 1. Queues: Queues can subscribe to more than one topic and receive messages for all topics matching their subscriptions. 2. Topic Endpoints: A topic endpoint attracts messages published to a single topic for which the topic endpoint has a matching subscription. ## Message VPN - 在Event Broker上,用來grouping - 哪些client可以接收哪些publisher publish的messages,他們connect到同一個Message VPN - 一個VPN中的publisher送出的訊息只會送給連接到同樣VPN的consumer - 一個Message VPN中包含一或多個topic (不確定概念是否正確? - VPN是一個channel - topic是一個實體訂閱單位 ## Event Mesh DMR