-
-
Notifications
You must be signed in to change notification settings - Fork 106
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #716 from scalecube/make-jackson-optinal
Add functionality for custom codecs installation
- Loading branch information
Showing
9 changed files
with
144 additions
and
39 deletions.
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
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
50 changes: 50 additions & 0 deletions
50
...arent/services-examples/src/main/java/io/scalecube/services/examples/codecs/Example1.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,50 @@ | ||
package io.scalecube.services.examples.codecs; | ||
|
||
import io.scalecube.net.Address; | ||
import io.scalecube.services.Microservices; | ||
import io.scalecube.services.discovery.ScalecubeServiceDiscovery; | ||
import io.scalecube.services.examples.helloworld.service.GreetingServiceImpl; | ||
import io.scalecube.services.examples.helloworld.service.api.GreetingsService; | ||
import io.scalecube.services.transport.rsocket.RSocketServiceTransport; | ||
|
||
public class Example1 { | ||
|
||
public static final String CONTENT_TYPE = "application/protostuff"; | ||
|
||
/** | ||
* Start the example. | ||
* | ||
* @param args ignored | ||
*/ | ||
public static void main(String[] args) { | ||
// ScaleCube Node node with no members | ||
Microservices seed = | ||
Microservices.builder() | ||
.discovery(ScalecubeServiceDiscovery::new) | ||
.transport(RSocketServiceTransport::new) | ||
.contentType(CONTENT_TYPE) // need to send with non-default data format | ||
.startAwait(); | ||
|
||
final Address seedAddress = seed.discovery().address(); | ||
|
||
// Construct a ScaleCube node which joins the cluster hosting the Greeting Service | ||
Microservices ms = | ||
Microservices.builder() | ||
.discovery( | ||
endpoint -> | ||
new ScalecubeServiceDiscovery(endpoint) | ||
.membership(cfg -> cfg.seedMembers(seedAddress))) | ||
.transport(RSocketServiceTransport::new) | ||
.services(new GreetingServiceImpl()) | ||
.startAwait(); | ||
|
||
// Create service proxy | ||
GreetingsService service = seed.call().api(GreetingsService.class); | ||
|
||
// Execute the services and subscribe to service events | ||
service.sayHello("joe").subscribe(consumer -> System.out.println(consumer.message())); | ||
|
||
seed.onShutdown().block(); | ||
ms.onShutdown().block(); | ||
} | ||
} |
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
Oops, something went wrong.