小编Ale*_*ksG的帖子

Flowtype - 如何导出和导入类型?

我已经关注https://flow.org/en/docs/install/,当在单个文件中使用时,流程正常工作,如下所示:

 // @flow 

type NumberAlias = number;

const n: NumberAlias = "123";
Run Code Online (Sandbox Code Playgroud)

Flow会正确地指出:

  5: const n: NumberAlias = "123";
                            ^^^^^ string. This type is incompatible with
  5: const n: NumberAlias = "123";
              ^^^^^^^^^^^ number
Run Code Online (Sandbox Code Playgroud)

我尝试从moduleA导出类型并在moduleB中导入该类型时出现问题:

(moduleA.js)

// @flow 

export type NumberAlias = number;
Run Code Online (Sandbox Code Playgroud)

(moduleB.js)

// @flow

import type { NumberAlias } from './moduleA';

const n: NumberAlias = 123;
Run Code Online (Sandbox Code Playgroud)

Flow抱怨:

src/moduleB.js:3
  3: import type { NumberAlias } from './moduleA';
                                      ^^^^^^^^^^^ ./moduleA. Required module not found
Run Code Online (Sandbox Code Playgroud)

这不是它在https://flow.org/en/docs/types/modules/中的描述吗? …

javascript flowtype

9
推荐指数
1
解决办法
780
查看次数

Azure 服务总线事务发件箱模式的替代方案

假设我有一个通用的传奇场景(给定三个不同的微服务 A、B 和 C,通过消息传递进行通信):

 1. Service A
    a. Performs operation A successfully
    b. Communicates update with message A
 2. Service B (after receiving message A)
    a. Performs operation B successfully
    b. Communicates update with message B
 3. Service C (after receiving message B)
    a. Fails to perform operation B
    b. Communicates failure
 4. Service A and B performs compensating actions
Run Code Online (Sandbox Code Playgroud)

据我了解,虽然整个工作流程应该最终保持一致,但您希望确保本地操作( 和ab在事务上保持一致,以避免丢失消息(或者如果相反,避免发送消息但无法持久保存操作更改)。

如果我没记错的话,这就是事务发件箱模式旨在解决的问题。

在 Azure 上的 .NET 上下文中,使用

  • EF核心
  • Azure 服务总线

有没有一种方法可以在不将消息保存到数据库的情况下获得相同级别的事务安全性(即不使用事务发件箱)?

我见过很多System.Transactions提及,但它要么用于多个数据库操作 …

transactions consistency azure azureservicebus entity-framework-core

2
推荐指数
1
解决办法
1654
查看次数