<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>micro service on 时光机</title>
    <link>https://doracl.github.io/tags/micro-service/</link>
    <description>Recent content in micro service on 时光机</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>zh-cn</language>
    <copyright>&amp;copy; 2019. All rights reserved.</copyright>
    <lastBuildDate>Sat, 25 May 2019 09:21:48 +0000</lastBuildDate>
    
	<atom:link href="https://doracl.github.io/tags/micro-service/index.xml" rel="self" type="application/rss+xml" />
    
    
    <item>
      <title>Outbox Pattern: 可靠的微服务数据交换模式</title>
      <link>https://doracl.github.io/post/2019/05/20190525/</link>
      <pubDate>Sat, 25 May 2019 09:21:48 +0000</pubDate>
      
      <guid>https://doracl.github.io/post/2019/05/20190525/</guid>
      <description>对于采用微服务架构的业务系统来说，很难做到只更新自身服务的数据，更多是要通知其它服务,哪些单据或档案由什么变成了什么。Outbox Pattern 使源服务 “read your own writes”，同时提供跨服务可靠，最终一致的数据交换。
微服务，最头疼的地方就是数据问题，如果你也曾经在业务系统中使用，一定深有体会。关于其它方案的探讨就不再深入了，感兴趣的可以看一下：Reliable Microservices Data Exchange With the Outbox Pattern 接下来只是照本宣科，应用到自己系统中。
注意：该模式与特定的实现选择并无关系，是否使用ORM，使用JPA/Hibernate，Spring Boot，等其它技术，其它语言。现在讨论一此细节 Outbox Table 的表结构：
Column | Type | Modifiers --------------+------------------------+----------- id | uuid | not null aggregatetype | character varying(255) | not null aggregateid | character varying(255) | not null type | character varying(255) | not null payload | jsonb | not null   id: 事件的唯一标识; 可以用于消费者判断是否重复消息.
 aggregatetype: 事件产生者的类型，比如生产订单.
 aggregateid: 事件产生者的ID</description>
    </item>
    
  </channel>
</rss>