Skip to content

Adding documentation for examples - #137

Closed
marcosreyes05 wants to merge 0 commit into
dapr:java_sdk_wipfrom
marcosreyes05:java_sdk_wip
Closed

marcosreyes05 wants to merge 0 commit into
dapr:java_sdk_wipfrom
marcosreyes05:java_sdk_wip

Conversation

@marcosreyes05

Copy link
Copy Markdown
Contributor

Description

Adding documentation for examples

Issue reference

We strive to have all PR being opened based on an issue, where the problem or feature have been discussed prior to implementation.

Please reference the issue this PR will close: #[37] #[36] #[87]

Checklist

Please make sure you've completed the relevant tasks for this PR, out of the following list:

  • Code compiles correctly
  • Created/updated tests
  • Extended the documentation

@marcosreyes05 marcosreyes05 changed the title Java sdk wip Adding documentation for examples Jan 21, 2020
@youngbupark
youngbupark requested a review from msfussell January 22, 2020 11:07
* 2. cd to [repo-root]/examples
* 3. Run :
* dapr run --app-id inputbinding --app-port 3000 --port 3005 -- mvn exec:java -Dexec.mainClass=io.dapr.examples.bindings.http.InputBindingExample -Dexec.args="-p 3000"
* dapr run --app-id inputbinding --app-port 3000 --port 3005 -- mvn exec:java -D exec.mainClass=io.dapr.examples.bindings.http.InputBindingExample -D exec.args="-p 3000"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Command does not work because class is still in the old package name.

* 2. cd to [repo-root]/examples
* 3. Run the program:
* dapr run --app-id outputbinding --port 3006 -- mvn exec:java -Dexec.mainClass=io.dapr.examples.bindings.http.OutputBindingExample
* dapr run --app-id outputbinding --port 3006 -- mvn exec:java -D exec.mainClass=io.dapr.examples.bindings.http.OutputBindingExample

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wrong package name here too.

@@ -0,0 +1,130 @@
# Dapr Bindings Sample

In this sample, we'll create two java applications: An output binding application and an input binding application, using Dapr Java SDK.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"applications: an"

# Dapr Bindings Sample

In this sample, we'll create two java applications: An output binding application and an input binding application, using Dapr Java SDK.
This sample includes two applications:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only enumerate the main classes. Controller should be described separately.


## Binding sample using the Java-SDK

This sample uses the capabilities provided in Dapr Java SDK for invoking bindings. Default implementation for binding event system is Kafka but others are also available.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"for publishing bindings"


## Remote invocation using the Java-SDK

This sample uses the Client provided in Dapr Java SDK for exposing and invoking a remote method.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For exposing the endpoint, it is not using the SDK anymore. We are using Springboot but not the SDK directly.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For invoking we still use the SDK.

// If port string is not valid, it will throw an exception.
int port = Integer.parseInt(cmd.getOptionValue("port"));

DaprApplication.start(port);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Explain what this command does and what the DaprApplication class does.

*/

package io.dapr.examples.pubsub.http;
package io.dapr.examples.pubsub;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This example will become http specific again.


Messages have been published in the topic.

### Running the subscriber

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would imagine that the subscriber would run first.


### Running the subscriber

The other component is the subscriber. It will subscribe to the same topic used by the publisher and read the messages previously published. The Subscriber uses the Spring Boot´s DaprApplication class for initializing the `SubscriberController`. In `Subscriber.java` file, you will find the `Subscriber` class and the `main` method. See the code snippet below:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because it refers to SpringBoot now, it is http-specific again.

@artursouza
artursouza changed the base branch from java_sdk_wip to it1 January 24, 2020 19:07
@artursouza
artursouza changed the base branch from it1 to java_sdk_wip January 24, 2020 19:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants