遵循典型的微服务 REST 架构,其中多个服务器运行并公开不同的控制器,为每个功能单独提供服务。
我的问题是这样的:
假设我的业务逻辑 = 一个实时 Web 应用程序,需要实时计算和实时响应,其中应用程序中的多个客户端相互通信。
我的选择仅限于仅在每个浏览器之间使用 websocket 连接,并在它们之间连接中介服务器。
但是,该架构对我来说有点模糊,因为我对整体中介不感兴趣!
如果我遵循 REST 微服务架构,我将强制每个浏览器打开多个/大量套接字连接,这不是我的目标
我的方法是通过来自每个客户端的一个套接字连接消耗所有套接字事件,并在后端领域处理它
我的想象力让我进一步想象一个包含多个微服务的架构,如下所示:
全部与内部插座连接,就像一个大后端网格一样
但这会失败,因为我需要扩展...扩展每个功能后端服务器以支持每秒数百万个请求。
那么这会让我维护彼此相关的每个集群?
通过阅读本文,您可能会理解这个主题的原因需要一些架构思想。
我对高可维护性和性能的追求需要一个复杂的架构,但我越想它,我就越会回到单体方法。
有推荐的架构吗?
对于非程序员高级实体(我认为),gradle构建工具的大象图标看起来并不专业,而较旧的图标则看起来更加专业。
我的目标是找到一种方法来还原到IDE上的上一个gradle图标。
试图在intellij的文档上找到这个答案没有成功,尝试了许多google搜索,调查了许多intellij-idea选项,搜索了stackoverflow的相关主题,但是没有运气。
我敢肯定,尽管这个问题与代码无关,但它与每个愿意为此找到解决方案的java / scala / kotlin程序员有关。
我在以下代码中收到编译错误"并非所有代码路径返回值",为什么?!
public class SomeEntity
{
public int m_i;
public SomeEntity(int i)
{
m_i = i;
}
public override string ToString()
{
return m_i.ToString();
}
public static int someFunction(int i) { return i + 100; }
public static IEnumerable GetEntities()
{
int [] arr = {1,2,3};
foreach (int i in arr)
{
// for (int i = 0; i < someArray.Count();i++)
// yield return new SomeEntity(someFunction(i));
// *** Equivalent linq function ***
return Enumerable.Range(0, 7).Select(a => new SomeEntity(someFunction(a)));
}
}
} …Run Code Online (Sandbox Code Playgroud) 留下LINQ使用的性能成本,我想知道如何将以下代码转换为LINQ表达式
for (int i = 0; i < someArray.length(); i++)
yield return new SomeEntity(someFunction(i));
Run Code Online (Sandbox Code Playgroud)
重要提示:我需要使用递增的索引
更新:
而不是someArray.length(),number应使用:
for (int i = 0; i < number; i++)
yield return new SomeEntity(someFunction(i));
Run Code Online (Sandbox Code Playgroud)
第二次更新
我仍然收到编译错误"并非所有代码路径返回值"
我的代码:
public static IEnumerable function()
{
Enumerable.Range(0,5).Select(i => new Entity());
}
Run Code Online (Sandbox Code Playgroud)
第3次更新
直到我发现它是导致此错误的原因才认为它是相关的..
public static IEnumerable function()
{
int[] arr = { 1, 2, 3, 4 };
foreach (int i in arr)
{
Enumerable.Range(0,5).Select(i => new Entity());
}
}
Run Code Online (Sandbox Code Playgroud)
如果你从方程式中取出foreach第一个循环,所有回复都回答了这个问题,但是我的问题是n ^ 2 .. 2个嵌套循环...... …
我的目标是掌握LINQ库函数.
我的问题是,如何在SelectMany迭代中调用多个Selects?
请考虑以下代码:
foreach(var i in array){
for(int i=0; i<10; i++)
yield return someOtherArray[i];
for(int i=0; i<10; i++)
yield return someOtherArray[i];
}
Run Code Online (Sandbox Code Playgroud)
我知道1循环嵌套的转换,
return array.SelectMany(x =>
Enumerable.Range(0,10)
.Select(i => someOtherArray[i]));
Run Code Online (Sandbox Code Playgroud)
但是我究竟如何在selectMany范围内的另一个分离的内部for循环上运行?
编辑#1
我需要在父数组中运行2个数组
foreach(var i in array) {
for(int i=0; i<10; i++)
yield return someOtherArray_A[i];
for(int i=0; i<10; i++)
yield return someOtherArray_B[i];
}
Run Code Online (Sandbox Code Playgroud)
编辑#2
为改变这么多的输入道歉,我试图让它更接近我的真正问题.
foreach(var j in array) {
for(int i=0; i<20; i++)
yield return someOtherArray_A[i];
for(int i=0; i<10; i++)
yield return someOtherArray_B[i];
}
Run Code Online (Sandbox Code Playgroud) 场景:
问题是,必须构建ConsoleApplication以生成它的程序集(.exe),以便基本上运行..
其他项目依赖于ConsoleApplication生成的文件,是否可以在构建其余项目之前在预构建事件或其他一些创造性解决方案上执行控制台应用程序?
如果是这样的话,最好有一些相关的信息
提前致谢