微服务:工作者角色、API 还是两者兼而有之? [英] Microservices: Worker roles, APIs or both?
问题描述
我已经看到了将微服务作为辅助角色处理队列外的请求和/或作为 API (REST) 实现的混合示例.
I have seen mixed examples of Microservices implemented as worker roles processing requests off a queue and/or as APIs (REST).
支持异步场景,可以使用队列,通过一个简单的哑队列监听器将请求转发到微服务 REST API,而同步场景将直接调用 REST API.
Supporting asynchronous scenarios, a queue can be utilized, with a simple dumb queue listener forwarding the request to a Microservice REST API, where as synchronous scenarios would call the REST API directly.
我认为微服务这个词的定义很模糊;人们是否将它们视为 API(例如 RESTful 服务)或任何抽象服务处理请求,但该请求是提供的吗?
The term Microservice is vaguely defined I think; do people consider them APIs (e.g. RESTful services) or as any abstract service processing requests, however that request was provided ?
推荐答案
您的微服务可以是一个公开几个 RESTful 端点的小型应用程序,也可以是一个接收队列的后台工作程序.它甚至可以是在某个事件上调用的 AWS Lambda 函数.
Your microservices can be a small application that exposes a few RESTful endpoints, or it can be a background worker that reaps a queue. It can even be an AWS Lambda function that's invoked on some event.
关键是您的应用程序由几个较小的应用程序组成,因此在部署代码、编程语言、框架等方面可以让您更加灵活.
The point is that your application is composed of several smaller applications, thus allowing you a greater amount of agility when it comes to deploying code, programming languages, frameworks, etc.
这篇关于微服务:工作者角色、API 还是两者兼而有之?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!