-
-
Notifications
You must be signed in to change notification settings - Fork 107
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Simplified service discovery and refactoring of registry events #342
Merged
segabriel
merged 8 commits into
develop
from
feature/hide-service-discovery-in-microservices
Sep 18, 2018
Merged
Changes from 1 commit
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
5af68d1
Simplified service discovery and refactoring of registry events
segabriel 1ef433f
Merge branch 'develop' into feature/hide-service-discovery-in-microse…
segabriel 5a7901d
Fixed merging issues
segabriel d357542
Fixed review issues
segabriel 084517f
Merge branch 'develop' into feature/hide-service-discovery-in-microse…
segabriel e066b49
Merge branch 'develop' into feature/hide-service-discovery-in-microse…
artem-v f5f3c1b
Merge branch 'develop' into feature/hide-service-discovery-in-microse…
artem-v af1b82f
CR2, cleanup; reviewed with Sergei G
artem-v File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 0 additions & 53 deletions
53
services-api/src/main/java/io/scalecube/services/discovery/api/DiscoveryEvent.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
services-api/src/main/java/io/scalecube/services/registry/api/EndpointRegistryEvent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package io.scalecube.services.registry.api; | ||
|
||
import io.scalecube.services.ServiceEndpoint; | ||
import io.scalecube.transport.Address; | ||
|
||
public class EndpointRegistryEvent { | ||
|
||
private ServiceEndpoint serviceEndpoint; | ||
private RegistryEventType type; | ||
|
||
public static EndpointRegistryEvent createAdded(ServiceEndpoint serviceEndpoint) { | ||
return new EndpointRegistryEvent(RegistryEventType.ADDED, serviceEndpoint); | ||
} | ||
|
||
public static EndpointRegistryEvent createRemoved(ServiceEndpoint serviceEndpoint) { | ||
return new EndpointRegistryEvent(RegistryEventType.REMOVED, serviceEndpoint); | ||
} | ||
|
||
private EndpointRegistryEvent(RegistryEventType type, ServiceEndpoint serviceEndpoint) { | ||
this.serviceEndpoint = serviceEndpoint; | ||
this.type = type; | ||
} | ||
|
||
private EndpointRegistryEvent(EndpointRegistryEvent e) { | ||
this.serviceEndpoint = e.serviceEndpoint; | ||
this.type = e.type; | ||
} | ||
|
||
public ServiceEndpoint serviceEndpoint() { | ||
return this.serviceEndpoint; | ||
} | ||
|
||
public boolean isAdded() { | ||
return RegistryEventType.ADDED.equals(type); | ||
} | ||
|
||
public boolean isRemoved() { | ||
return RegistryEventType.REMOVED.equals(type); | ||
} | ||
|
||
public RegistryEventType type() { | ||
return this.type; | ||
} | ||
|
||
public Address address() { | ||
return Address.create(this.serviceEndpoint.host(), this.serviceEndpoint.port()); | ||
} | ||
} |
48 changes: 48 additions & 0 deletions
48
services-api/src/main/java/io/scalecube/services/registry/api/ReferenceRegistryEvent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package io.scalecube.services.registry.api; | ||
|
||
import io.scalecube.services.ServiceReference; | ||
import io.scalecube.transport.Address; | ||
|
||
public class ReferenceRegistryEvent { | ||
|
||
private ServiceReference serviceReference; | ||
private RegistryEventType type; | ||
|
||
public static ReferenceRegistryEvent createAdded(ServiceReference serviceReference) { | ||
return new ReferenceRegistryEvent(RegistryEventType.ADDED, serviceReference); | ||
} | ||
|
||
public static ReferenceRegistryEvent createRemoved(ServiceReference serviceReference) { | ||
return new ReferenceRegistryEvent(RegistryEventType.REMOVED, serviceReference); | ||
} | ||
|
||
private ReferenceRegistryEvent(RegistryEventType type, ServiceReference serviceReference) { | ||
this.serviceReference = serviceReference; | ||
this.type = type; | ||
} | ||
|
||
private ReferenceRegistryEvent(ReferenceRegistryEvent e) { | ||
this.serviceReference = e.serviceReference; | ||
this.type = e.type; | ||
} | ||
|
||
public ServiceReference serviceReference() { | ||
return this.serviceReference; | ||
} | ||
|
||
public boolean isAdded() { | ||
return RegistryEventType.ADDED.equals(type); | ||
} | ||
|
||
public boolean isRemoved() { | ||
return RegistryEventType.REMOVED.equals(type); | ||
} | ||
|
||
public RegistryEventType type() { | ||
return this.type; | ||
} | ||
|
||
public Address address() { | ||
return Address.create(this.serviceReference.host(), this.serviceReference.port()); | ||
} | ||
} |
53 changes: 0 additions & 53 deletions
53
services-api/src/main/java/io/scalecube/services/registry/api/RegistryEvent.java
This file was deleted.
Oops, something went wrong.
6 changes: 6 additions & 0 deletions
6
services-api/src/main/java/io/scalecube/services/registry/api/RegistryEventType.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package io.scalecube.services.registry.api; | ||
|
||
public enum RegistryEventType { | ||
ADDED, | ||
REMOVED; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,7 +23,9 @@ public interface ServiceRegistry { | |
|
||
ServiceEndpoint unregisterService(String endpointId); | ||
|
||
Flux<RegistryEvent> listen(); | ||
Flux<ReferenceRegistryEvent> listenReferenceEvents(); | ||
|
||
Flux<EndpointRegistryEvent> listenEndpointEvents(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same as above |
||
|
||
Mono<Void> close(); | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i dont like this contract its bloated to have this kind in the interface
maybe we can provide more clean interface?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
something like: