Comments (6)
after microservices has started its already an immutable object.
microservices are automatically registered and discovered within a node and they publish locally and remotely the services they host within a Microservices node in the network of microservices based on SWIM.
you can checkout the examples and the tests inside the project
https://github.com/scalecube/scalecube-services/tree/master/services-examples
the main idea is that any node can be a seed
one address that allows all services to join the cluster of services.
using gossip and SWIM discovery protocol once a member joined the cluster all other members automatically aware of it
it means that seed is only used for first handshake and act as a well known address to join the cluster
after this there is no need of seed until next member want to join.
so its not mandatory to join the cluster via seed in case somehow you know the address of the any node.
when a member joins a cluster he can just start or start pointing to some seed member.
final Address seedAddress = seed.discovery().address();
.membership(cfg -> cfg.seedMembers(seedAddress)))
// ScaleCube Node with no members
Microservices seed =
Microservices.builder()
.discovery(
serviceEndpoint ->
new ScalecubeServiceDiscovery()
.transport(cfg -> cfg.transportFactory(new WebsocketTransportFactory()))
.options(opts -> opts.metadata(serviceEndpoint)))
.transport(RSocketServiceTransport::new)
.startAwait();
final Address seedAddress = seed.discovery().address();
// Construct a ScaleCube node which joins the cluster hosting the Greeting Service
Microservices ms =
Microservices.builder()
.discovery(
"ms",
endpoint ->
new ScalecubeServiceDiscovery()
.transport(cfg -> cfg.transportFactory(new WebsocketTransportFactory()))
.options(opts -> opts.metadata(endpoint))
.membership(cfg -> cfg.seedMembers(seedAddress)))
.transport(RSocketServiceTransport::new)
.services(new GreetingServiceImpl())
.startAwait();
``
from scalecube-services.
Sorry,Maybe you don't understand my scenes.
ServiceMethodRegistry registry = new ServiceMethodRegistryImpl();
Microservices ms =
Microservices.builder()
.discovery(
"ms",
endpoint ->
new ScalecubeServiceDiscovery()
.transport(cfg -> cfg.transportFactory(new WebsocketTransportFactory()))
.options(opts -> opts.metadata(endpoint))
.membership(cfg -> cfg.seedMembers(seedAddress)))
.transport(RSocketServiceTransport::new)
.methodRegistry(registry)
.startAwait();
// register a service after Microservices started
registry.registerService(ServiceInfo
.fromServiceInstance(new GreetingServiceImpl())
....
.build())
from scalecube-services.
ohh i see
once microservices is started its immutable.
so any change that is done to method registry will not take effect.
this is because on start there is introspection of the microservices and registration of them to the cluster.
so adding anything to the registry after start does not make any sense.
from scalecube-services.
MembershipEvent
has UPDATED
Type, Is there a plan to support ServiceDiscoveryEvent.Type
?
from scalecube-services.
scalecube is an open source project - anyone is welcome to fork/offer improvements.
pull request are considered/accepted with a reasoning what is the motivation for the improvement.
from scalecube-services.
from scalecube-services.
Related Issues (20)
- Investigate warnings due to java.nio.channels.ClosedChannelException from rsocket client HOT 3
- Reconsider/refactor/simplify code in .toResponse HOT 3
- Change error qualifer format HOT 4
- Create settings function for `headers` in ServiceCall HOT 1
- Refactor ServiceMethodInvoker.authenticate line 158 HOT 1
- Support qualifier format with version HOT 1
- Headers Naming Convention
- Why Service interface and qualifier has one-to-one relationship HOT 5
- NoSuchElementException from Microservices#discovery HOT 4
- Incorrect REQUEST_CHANNEL method
- Move ConnectionSetupCodec to scalecube-services-api
- Is there any up to date documentation anywhere? HOT 1
- Website expired? HOT 2
- Measure performance with java 17 + loom enabled HOT 1
- Java 9+ Module Support HOT 1
- Add AutoCloseable on Microservices HOT 3
- kubernetes
- Dynamic service registration after Microservices instance is started
- scalecube github page HOT 1
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 scalecube-services.