微服务架构依赖(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
最满意答案
您可以使用
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)[2023-08-29]
不幸的是,似乎没有任何自由选择。 Illatis Stepin是一款基于Eclipse的IDE,用于调试存储过程。 价格是每个许可证40美元。 还有MySQL调试器 ,每个头50美元。 但是,如果您有博客,MyDebugger会提供许可证 - 您可以获得许可证以获取有关该产品的博客。 调试器是否用于开源项目? 如果是这样,您可以尝试联系发布商,看看他们是否会授予您许可证,或许可以在您的项目页面上提及。 如果是用于商业开发,您可能会尝试获得$ 40-50许可费用的批准。 调试器可能会为您节省数小时的时间,因此 ... -
在你的rsreportserver.config文件中检查Add Key =“DatabaseQueryTimeout”Value =“120”的值。 你可能还需要在那里增加它。 有关该文件的更多信息: http://msdn.microsoft.com/en-us/library/ms157273.aspx 此外,除了您的帖子中的第一位评论者所说的内容外,根据我的经验,如果您要渲染为PDF,那么也可以超时。 您的大型数据集将返回合理的时间量,但PDF的呈现可能会持续一段时间。 尝试渲染到Excel。 BI ...
-
ExecuteNonQuery将返回受INSERT,UPDATE或DELETE操作影响的行数,而不是存储过程的返回值。 如果它在过去工作,您的查询是否有可能修改数据? 要获取存储过程的返回值,请使用ParameterDirection.ReturnValue向命令添加参数。 在调用ExecuteNonQuery()之后,将使用存储过程的返回值填充该参数。 ExecuteNonQuery will return the number of rows affected by an INSERT, UPDATE ...
-
在SQL Server 2008 Management Studio中调试存储过程(Debugging stored procedure in SQL Server 2008 Management Studio)[2023-05-20]
只需编写一个正确调用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)[2023-01-20]
好吧,所以我设法说服DBA将数据传输到varbinary(max)数据类型的新列。 然后,我在将这些值加密后将这些值转移到新列中,然后删除旧列并将新列更名为旧名。 做了一些工作,但现在一切正常。 我设法创建了一个存储过程和两个函数来进一步模块化脚本。 打开对称密钥 CREATE PROCEDURE sp_OpenEncryptionKeys AS BEGIN SET NOCOUNT ON; BEGIN TRY OPEN SYMMETRIC KEY Enc ... -
用vs 2008调试?(debugging with vs 2008?)[2022-03-31]
请确保您将默认的“托管代码”更改为“托管代码”。 这让我几次。 Make sure you change Attach To to Script from the default which is Managed Code. This got me a few times. -
这里有几个可能性。 首先,你必须将SQL视为动态SQL。 其次,Oracle DDL语句不能在事务中运行(或者,它们终止当前事务并且不能自己回滚)。 这可能会影响您是否可以在存储过程中使用它们,或者可以使用包含它们的存储过程。 如果以上都不适用 - 可能很容易出现别的错误 - 我建议发布一些代码。 Here are a couple of possibilities. First, you would have to treat the SQL as dynamic SQL. Second, Oracle ...
-
使用VS 2008调试存储过程时获取命令超时(Getting Command Timeout while debugging Stored Procedure with VS 2008)[2023-05-30]
您可以使用 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-pro ... -
您看到“查询输出附近的语法不正确”。 这是一个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 Serve ...
-
我已经解决了它改变程序的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.