微服务架构依赖(Microservice Architecture dependency)

我已经阅读了很多关于微服务架构的内容,但有一件事我不明白如何实现并希望你可以帮助我...

假设我有一个web-api-endpoint,它接收OrderMicroservice负责处理的命令。 当订单被放置时,必须更新库存,以便OrderMS向订户发布事件(使用例如Nats的pub / sub),而InventoryMS将更新库存,因为它订阅当前事件/消息....我想要松散耦合架构并使用asynch调用对给定信息感兴趣的模块/ MS。

如果您有1个InventoryMS实例,那么情况将完全正常但如果您横向扩展了InventoryMS会发生什么情况,即有5个InventoryMS实例并且他们都订阅inventory.change.event并将尝试更新库存?

我应该使用什么样的架构或消息模式来实现这样的场景,因为我可以在MS彼此依赖时使用松耦合架构? 一种方式是通过使用断路器模式的REST调用在内部进行通信,但后来我觉得我构建了具有一定智能性的断路器(断路器)......

谢谢你的帮助!


I have read a lot about microservice architecture but there is one thing that I dont understand how to achieve and hope you can help me with this...

Lets say I have a web-api-endpoint that recieves orders that an OrderMicroservice is responsible to handle. When order is put Inventory must be updated so OrderMS publish an event to subscribers (pub/sub using for example Nats) and InventoryMS will update the inventory due to it is subscribing to current event/message....I want to have a loose coupled architecture and use asynch calls to modules/MSs thats are interested in given info.

Given scenario will work perfectly fine if you have 1 instance of InventoryMS but what happens if you have scaled the InventoryMS horizontally i.e there are 5 instances of InventoryMS and all of them subscribes to inventory.change.event and will try to update the inventory?

What kind of architecture or message pattern should I use for a scenario like this with horizonatally scalled MS's so I can have a loose coupled architecture when MSs are dependent of each other? One way is that communication internally is made by REST-calls using circuit breaker pattern but then I feel that I build a monolite of MSs with some smartness (the circuit breaker)...

Thanks for your help!


原文:https://stackoverflow.com/questions/43378165
2024-01-08 13:01

满意答案

您可以使用

SqlCommand.CommandTimeout = 0; //0 is for unlimited 

或者您可以使用预处理器指令仅用于调试目的,请参阅此处http://msdn.microsoft.com/en-us/library/ed8yd1ha(v=vs.71).aspx和此处C#中的预处理器指令是一些细节。


You can use

SqlCommand.CommandTimeout = 0; //0 is for unlimited 

Or you can use pre-processor directives just for debugging purpose see here http://msdn.microsoft.com/en-us/library/ed8yd1ha(v=vs.71).aspx and here Pre-Processor directives in C# are some details.

相关问答

更多

MySQL存储过程调试(MySQL stored procedure debugging)

不幸的是,似乎没有任何自由选择。 Illatis Stepin是一款基于Eclipse的IDE,用于调试存储过程。 价格是每个许可证40美元。 还有MySQL调试器 ,每个头50美元。 但是,如果您有博客,MyDebugger会提供许可证 - 您可以获得许可证以获取有关该产品的博客。 调试器是否用于开源项目? 如果是这样,您可以尝试联系发布商,看看他们是否会授予您许可证,或许可以在您的项目页面上提及。 如果是用于商业开发,您可能会尝试获得$ 40-50许可费用的批准。 调试器可能会为您节省数小时的...

BIDS SSRS在使用存储过程时报告查询超时问题,同时适当设置超时设置(BIDS SSRS Report query timeout issue while using Stored Procedure with timeout settings set appropriately)

在你的rsreportserver.config文件中检查Add Key =“DatabaseQueryTimeout”Value =“120”的值。 你可能还需要在那里增加它。 有关该文件的更多信息: http://msdn.microsoft.com/en-us/library/ms157273.aspx 此外,除了您的帖子中的第一位评论者所说的内容外,根据我的经验,如果您要渲染为PDF,那么也可以超时。 您的大型数据集将返回合理的时间量,但PDF的呈现可能会持续一段时间。 尝试渲染到Exce...

SQL Server 2008存储过程突然返回-1(SQL Server 2008 Stored Proc suddenly returns -1)

ExecuteNonQuery将返回受INSERT,UPDATE或DELETE操作影响的行数,而不是存储过程的返回值。 如果它在过去工作,您的查询是否有可能修改数据? 要获取存储过程的返回值,请使用ParameterDirection.ReturnValue向命令添加参数。 在调用ExecuteNonQuery()之后,将使用存储过程的返回值填充该参数。 ExecuteNonQuery will return the number of rows affected by an INSERT, UP...

在SQL Server 2008 Management Studio中调试存储过程(Debugging stored procedure in SQL Server 2008 Management Studio)

只需编写一个正确调用SP的查询并调试: exec MySP p1 p2 etc Just write a query that correctly invokes your SP and debug that: exec MySP p1 p2 etc

在MS SQL Server 2008中为AES加密创建存储过程(Create a Stored Procedure for AES Encryption in MS SQL Server 2008)

好吧,所以我设法说服DBA将数据传输到varbinary(max)数据类型的新列。 然后,我在将这些值加密后将这些值转移到新列中,然后删除旧列并将新列更名为旧名。 做了一些工作,但现在一切正常。 我设法创建了一个存储过程和两个函数来进一步模块化脚本。 打开对称密钥 CREATE PROCEDURE sp_OpenEncryptionKeys AS BEGIN SET NOCOUNT ON; BEGIN TRY OPEN SYMMETRIC KE...

用vs 2008调试?(debugging with vs 2008?)

请确保您将默认的“托管代码”更改为“托管代码”。 这让我几次。 Make sure you change Attach To to Script from the default which is Managed Code. This got me a few times.

使用Alter命令的Oracle存储过程(Oracle Stored Procedure with Alter command)

这里有几个可能性。 首先,你必须将SQL视为动态SQL。 其次,Oracle DDL语句不能在事务中运行(或者,它们终止当前事务并且不能自己回滚)。 这可能会影响您是否可以在存储过程中使用它们,或者可以使用包含它们的存储过程。 如果以上都不适用 - 可能很容易出现别的错误 - 我建议发布一些代码。 Here are a couple of possibilities. First, you would have to treat the SQL as dynamic SQL. Second, Or...

使用VS 2008调试存储过程时获取命令超时(Getting Command Timeout while debugging Stored Procedure with VS 2008)

您可以使用 SqlCommand.CommandTimeout = 0; //0 is for unlimited 或者您可以使用预处理器指令仅用于调试目的,请参阅此处http://msdn.microsoft.com/en-us/library/ed8yd1ha(v=vs.71).aspx和此处C#中的预处理器指令是一些细节。 You can use SqlCommand.CommandTimeout = 0; //0 is for unlimited Or you can use pr...

在SQL Server 2008中的存储过程中导出为CSV(Export to CSV in stored procedure in SQL Server 2008)

您看到“查询输出附近的语法不正确”。 这是一个T-SQL错误消息。 正如你所说,你是在存储过程中运行它。 BCP和SQLCMD都是命令行实用程序,这意味着您必须从命令(DOS)提示符运行它们。 有一种直接从SQL执行的方法,但你必须使用: xp_cmdshell这是一篇关于如何使用它的好文章: https://www.mssqltips.com/sqlservertip/1633/simple-way-to-export-sql-server-data-to-text-files/ 这是为SQL ...

在存储过程调用上获取超时(Getting Timeout on stored procedure call)

我已经解决了它改变程序的TimeOut时间(默认为30秒)。 发生这种情况是因为在服务器上直接执行SP与在作业中执行SP不同。 I've solved it changing the TimeOut time of the procedure (which was of 30 secs by default). This happens because it isn't the same to execute a SP directly on the server than in the job....

相关文章

更多

Solr Architecture[转]

Lucene/Solr plugins •RequestHandlers – handle a r ...

Stack Overflow Architecture Update - Now At 95 Million Page Views A Month

A lot has happened since my first article on theSta ...

sbt添加依赖库

使用sbt作为类库管理工具: 用sbt创建,运行,测试和发布项目都很方便,但这还不够,软件开发是要写 ...

Yupoo网站架构学习总结(转)

来源:http://www.itivy.com/ivy/archive/2011/8/16/the-a ...

Solr搜索服务架构图

分享我自己的Solr搜索服务架构图以及几张Solr的架构图。 在Google Doc上的两页ppt: ...

分散处理 Hadoop架构服务器角色分工

  在 Hadoop运算集群架构中,先分解任务,分工处理再汇总结果这些服务器依据用途可分成Mast ...

JFreeChart架构详解

JFreeChart基本类层次和应用水平的架构在基于Java应用程序如何工作的

微信架构的启示

微信架构pdf/ppt资料下载: http://yunpan.cn/QhGAdk6rVwywS (提取 ...

国内图片网站Yupoo的架构

之前向大家介绍过全球最大在线图片服务网站Flickr网站架构,Yupoo(又拍网)作为国内最大的图片服 ...

最新问答

更多

获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)

我用Google搜索了一个解决方案。 “EnumDisplayModeProvider”是我自己设置网站的各种模式的枚举。 public EnumDisplayModeProvider GetDisplayModeId() { foreach (var mode in DisplayModeProvider.Instance.Modes) if (mode.CanHandleContext(HttpContext)) {

如何通过引用返回对象?(How is returning an object by reference possible?)

这相对简单:在类的构造函数中,您可以分配内存,例如使用new 。 如果你制作一个对象的副本,你不是每次都分配新的内存,而是只复制指向原始内存块的指针,同时递增一个也存储在内存中的引用计数器,使得每个副本都是对象可以访问它。 如果引用计数降至零,则销毁对象将减少引用计数并仅释放分配的内存。 您只需要一个自定义复制构造函数和赋值运算符。 这基本上是共享指针的工作方式。 This is relatively easy: In the class' constructor, you allocate m

矩阵如何存储在内存中?(How are matrices stored in memory?)

正如它在“熵编码”中所说的那样,使用Z字形图案,与RLE一起使用,在许多情况下,RLE已经减小了尺寸。 但是,据我所知,DCT本身并没有给出稀疏矩阵。 但它通常会增强矩阵的熵。 这是compressen变得有损的点:输入矩阵用DCT传输,然后量化量化然后使用霍夫曼编码。 As it says in "Entropy coding" a zig-zag pattern is used, together with RLE which will already reduce size for man

每个请求的Java新会话?(Java New Session For Each Request?)

你是如何进行重定向的? 您是否事先调用了HttpServletResponse.encodeRedirectURL()? 在这里阅读javadoc 您可以使用它像response.sendRedirect(response.encodeRedirectURL(path)); The issue was with the path in the JSESSIONID cookie. I still can't figure out why it was being set to the tomca

css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)

我认为word-break ,如果你想在一个单词中打破行,你可以指定它,这样做可以解决问题: .column { word-break:break-all; } jsFiddle演示。 您可以在此处阅读有关word-break属性的更多信息。 I think word-break, with which you can specify if you want to break line within a word, will do the trick: .column { word-break

无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)

我认为您忘记在分类时间内缩放输入图像,如train_test.prototxt文件的第11行所示。 您可能应该在C ++代码中的某个位置乘以该因子,或者使用Caffe图层来缩放输入(请查看ELTWISE或POWER图层)。 编辑: 在评论中进行了一次对话之后,结果发现在classification.cpp文件中错误地删除了图像均值,而在原始训练/测试管道中没有减去图像均值。 I think you have forgotten to scale the input image during cl

xcode语法颜色编码解释?(xcode syntax color coding explained?)

转到: Xcode => Preferences => Fonts & Colors 您将看到每个语法高亮颜色旁边都有一个简短的解释。 Go to: Xcode => Preferences => Fonts & Colors You'll see that each syntax highlighting colour has a brief explanation next to it.

在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)

你考虑过第三方拼写检查吗? 您可以将在C#中开发的自定义WinForms控件插入访问数据库吗? VB6控件怎么样? 如果你能找到一个使用第三方库进行拼写检查的控件,那可能会有效。 Have you considered a third party spell checker? Can you insert a custom WinForms controls developed in C# into an access database? What about a VB6 control? If

从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)

我有同样的问题,因为我在远程服务器上有两个图像,我需要在每天的预定义时间复制到我的本地服务器,这是我能够提出的代码... try { if(@copy('url/to/source/image.ext', 'local/absolute/path/on/server/' . date("d-m-Y") . ".gif")) { } else { $errors = error_get_last(); throw new Exception($err

从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))

我不确定我完全明白你在说什么。 你能编辑你的帖子并包含你正在做的Subversion命令/操作的特定顺序吗? 最好使用命令行svn客户端,以便容易为其他人重现问题。 如果您只是想获取文件的旧副本(即使该文件不再存在),您可以使用如下命令: svn copy ${repo}/trunk/moduleA/file1@${rev} ${repo}/trunk/moduleB/file1 其中${repo}是您的存储库的URL, ${rev}是您想要的文件的版本。 这将恢复该文件的旧版本,包括最高版本