4 ms·
I was just talking with a friend about batch jobs, and I was remarking that they can also be considered microservices. The difference is that batch jobs don't n
by StavrosK 11y ago
I was just talking with a friend about batch jobs, and I was remarking that they can also be considered microservices. The difference is that batch jobs don't need to be interactive, so the contract is different.
Unfortunately it's a bit late for me to include this in the existing article, but it's a good topic for a next article. You will generally have a much easier time splitting tasks off and running them on workers than full-blown, standalone services (because the MQ can retry the tasks, they can be idempotent, you can have different timeouts, etc).
The usual definition of a microservice is a stricter subset of a task, in general.
- daxfohl 11y agoAgreed. In fact batch jobs are, in at least one dimension, more decoupled than strict microservices. Current client is a photobooth. Photos all can be shared from client app and web, each "share" is just a REST post containing "shareType:string" and "meta:json"; all share types (email, mms, twitter, etc) go through the same endpoint. Web api simply adds these to message queue for the corresponding "shareType" job to process. This way new types of sharing options can be added just by changing the client and adding the new batch worker; no updates to the web/api server app itself are necessary. Proper "microservices" are usually described as being directly coupled to each other. They're just the new hotness so everyone wants a piece. As most of the comments are saying, choose the shoe that fits.