Comments (6)
At first I recommend you to get familiar with NATS https://nats.io/documentation/
NATS is pub/sub system. In hemera every service is located by his topic name. If you want provide a service with different versions you can represent it with the topic name
On service level:
hemera.add({ topic: "math:v1.0" })
or with a wildcard
hemera.add({ topic: "math:v1.*" })
Wildcards in Nats: https://nats.io/documentation/internals/nats-protocol/
On application level
You can also express you different version with a different pattern so that your service is always accessible via the same topic. I prefer this solution because you have the most flexbility and less effort but this orientates on the complexity of both versions.
hemera.add({
topic: "math",
cmd:" add",
version: "1"
})
or with regex
hemera.add({
topic: "math",
cmd:" add",
version: /1\.[0-9]/
})
On server level
E.g different regions should only have access to api version 1.0. You can connect those clients with a different NATS server which exposed a restricted set of services. After a certain period of time you can also combine both server to a cluster. This use case is very special but possible.
You have three options how to deal with versioning.
from hemera.
One way is to archive it with a suffix in the topic name e.g
topic:math:v1
or in the pattern of your Server Methods
{
topic: "math",
cmd:" add",
Version: "1"
}
or you have different NATS Server for different API Version.
from hemera.
It's up to the use case.
from hemera.
right now I use semver for services (without the patch), and my service locator can deal with version pinning or version ranges, like '<=1.1' or '^1.1', so, asking for a version '^1.0' would yield access to any available 1.0 and 1.1 versions, could this be done?
just to explain why I use semver, since minor versions are backward compatible always, I can use blue/green without having to worry older services breaking when 1.0 goes offline and replaced by 1.1 for example
from hemera.
I will update the docs with this topic
from hemera.
Update the docs I close this issue.
from hemera.
Related Issues (20)
- Logging id HOT 15
- Direct communication ? HOT 3
- stats plugin not returning all actions HOT 7
- Does hemera.close() killall running jobs? HOT 2
- TypeError when defining custom Pino logger HOT 1
- Why https://hemerajs.github.io/hemera/docs/reference.html contains not documentation for add() function. HOT 3
- Adding hemera to Docusaurus users page HOT 3
- Unsubscribe by RegExp HOT 9
- Unable to subscribe to NATS topic when the publisher is not running on Hemera HOT 1
- Client Timeout HOT 3
- hemera-ajv doesnt seem to be working correctly HOT 4
- Hemera-blipp has old hemera version HOT 3
- Have you looked into ts-nats? HOT 3
- How to reply from middleware or extension? HOT 5
- Looking for maintainers and collaborators HOT 5
- NATS disconnection question HOT 1
- Calling reply.send inside async middleware doesn't stop the chain HOT 2
- Typescript support HOT 1
- hemera-zipkin package missing HOT 3
- Any way to unregister an extension? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hemera.