两个彼此高度依赖的本地服务之间,有什么良好的通信方式?

huangapple 未分类评论53阅读模式
英文:

What is a good way to communicate between two local services that heavily depend on each other?

问题

场景:我有两个服务/应用程序。

应用程序A是一个游戏服务器,负责接收游戏客户端发来的事件。现在,这个应用程序需要从应用程序B请求特定信息,比如已注册用户等。它还需要向应用程序B发送事件。所使用的语言是Java,我无法改变这一点。

应用程序B是一个处理用户存储的应用程序,其中包含授权逻辑等内容。它还充当整个系统的API,只有应用程序B能够与应用程序A进行通信。这个应用程序需要从应用程序A请求关于某些事物的信息,比如配置和已连接的用户/游戏客户端。它还需要向应用程序A发送通过API交互触发的事件。

我意识到这两个应用程序可以合并为一个,但我宁愿在NodeJS中编写API和逻辑,因为我更习惯这样做,而且不想使用Java。我简要地研究了WebSocket、Socket和标准HTTP请求作为通信手段,但不知道什么样的通信方式适合这种通信/耦合方式。

英文:

Scenario: I have two services/applications.

Application A is a game server, which receives events from game clients. This application now needs to request information from Application B for certain information, such as registered users etc. It also needs to send events to Application B. The language used is Java and there is nothing I can do about this.

Application B is an application that handles storage of users, contains authorization logic among other things. It also acts as an API for the whole thing, only Application B can communicate with Application A. This application needs to request information from Application A about certain things, such as configuration and connected users/game clients. It also needs to send events to Application A of events triggered via API interaction.

I realise that both applications could be written as one, but I would rather write the API and logic in NodeJS, since I'm more comfortable doing that and would rather not use Java. I've briefly looked at WebSockets, Sockets, and standard HTTP requests as means of communication but don't know what kind of communication that would suit this kind of communication/coupling.

huangapple
  • 本文由 发表于 2020年5月4日 17:18:12
  • 转载请务必保留本文链接:https://java.coder-hub.com/61588846.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定