Skip to content
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

First draft on Streaming Developer Guide #7

Closed

Conversation

ilayaperumalg
Copy link
Contributor

@ilayaperumalg ilayaperumalg commented Apr 19, 2019

  • Add Stream Introduction

    • Spring Cloud Stream & SCDF interactions
    • Binding properties
    • Binder properties
  • Standalone Stream development & testing

  • On RabbitMQ, Apache Kafka

  • Create OOTB stream

  • Creation of custom stream application

  • Continuous Delivery of streaming applications

  • Add stream features

Resolves spring-cloud/spring-cloud-dataflow#3096
Resolves spring-cloud/spring-cloud-dataflow#3098
Resolves spring-cloud/spring-cloud-dataflow#3172
Resolves spring-cloud/spring-cloud-dataflow#3173

.idea/workspace.xml Outdated Show resolved Hide resolved
@cppwfs
Copy link
Contributor

cppwfs commented Apr 22, 2019

Can't pull down the PR because of the .idea/ directory as well as shown here:

error: The following untracked working tree files would be overwritten by merge:
	.idea/workspace.xml
Please move or remove them before you merge.

@ilayaperumalg
Copy link
Contributor Author

@cppwfs Removed the .idea directory. Let me know if this works now.

@cppwfs
Copy link
Contributor

cppwfs commented Apr 22, 2019

@ilayaperumalg WOOHOO it works!

Copy link
Contributor

@sabbyanandan sabbyanandan left a comment

Choose a reason for hiding this comment

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

Just some general thoughts and suggestions.

### Application Registration

Spring Cloud Data Flow server has an application registry to refer all the individual streaming applications.
When you register an application, you would provide
Copy link
Contributor

Choose a reason for hiding this comment

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

Suffix with a colon


Let's register the standalone applications we tested previously.

NOTE: If you are running your Spring Cloud Data Flow server on docker environment, make sure the you have all your application artifact URIs are accessible.
Copy link
Contributor

Choose a reason for hiding this comment

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

server on docker environment should be server on the docker environment


Let's register the standalone applications we tested previously.

NOTE: If you are running your Spring Cloud Data Flow server on docker environment, make sure the you have all your application artifact URIs are accessible.
Copy link
Contributor

Choose a reason for hiding this comment

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

make sure the you have all your should be make sure that your


Once the stream is deployed on `Local` development environment, you can look the runtime applications via Dashboard's runtime page or using the SCDF Shell command `runtime apps`.
The runtime applications show information about where each application is running in the local environment and their log files locations.

Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure if we need to show the log info here.
But if we do we need show them a screenshot of where to obtain the log file location from runtime apps and then an example bash shell of them catting or tailing the log.


https://docs.spring.io/spring-cloud-dataflow/docs/current/reference/htmlsingle/#spring-cloud-dataflow-stream-lifecycle-update
The above SCDF shell command registers the `Maven` artifacts of the out of the box streaming applications that can work on `RabbitMQ` messaging middleware.
Copy link
Contributor

Choose a reason for hiding this comment

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

This says rabbitmq, but the examples show kafka.

@@ -6,3 +6,123 @@ summary: true
---

Discuss the set of features that will be covered.
Copy link
Contributor

Choose a reason for hiding this comment

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

This line is causing the generated page to not render properly. Needs to be moved below the meta-tags.

@cppwfs cppwfs self-assigned this Apr 23, 2019
@cppwfs
Copy link
Contributor

cppwfs commented Apr 26, 2019

@ilayaperumalg we need to remove the .idea files from the PR. The PR is failing to be pulled due to the following error:

error: The following untracked working tree files would be overwritten by merge:
	.idea/codeStyles/codeStyleConfig.xml
	.idea/dataflow.spring.io.iml
	.idea/misc.xml
	.idea/modules.xml
	.idea/vcs.xml
	.idea/workspace.xml
Please move or remove them before you merge.
Aborting

@ilayaperumalg
Copy link
Contributor Author

@cppwfs Sorry, it was my mistake when I pushed the changes without noticing the .idea directory (though I added this into .gitignore). Pushed the changes to remove the .idea directory now.

@cppwfs
Copy link
Contributor

cppwfs commented Apr 27, 2019 via email

 - Add Stream Introduction
   - Spring Cloud Stream & SCDF interactions
   - Binding properties
   - Binder properties

 - Standalone Stream development & testing
  - On RabbitMQ, Apache Kafka

 - Create OOTB stream
 - Creation of custom stream application

 - Continuous Delivery of streaming applications

 - Add stream features

Resolves #3096
Resolves #3098
Resolves #3172
Resolves #3173

1. Visit the [Spring Initialzr site](https://start.spring.io/).
1. Select the latest release of spring boot.
1. Create a new Maven project with a Group name of `com.example` and an Artifact name of `usage-detail-sender`.
Copy link
Contributor

Choose a reason for hiding this comment

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

instead of com.example we've been using io.spring

@@ -1,34 +1,110 @@
---
path: 'stream-developer-guides/getting-started/simple-stream'
title: 'Simple Stream '
description: 'Simple Stream '
title: 'Simple Stream'
Copy link
Contributor

Choose a reason for hiding this comment

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

The file 1-simple-stream file is missing the .md extension and is not getting rendered on the site.

If you would like to register `docker` artifacts

```
dataflow:> app import --uri http://bit.ly/Einstein-SR2-stream-applications-rabbit-docker
Copy link
Contributor

Choose a reason for hiding this comment

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

Need to discuss if we want UI images instead or in addition to shell commands @markpollack @sabbyanandan .

### Registering out of the box streaming applications using the Shell

```
dataflow:> app import --uri http://bit.ly/Einstein-SR2-stream-applications-kafka-maven
Copy link
Contributor

Choose a reason for hiding this comment

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

The app import should use RabbitMQ instead of Kafka, so that it matches the text and example below.


#### Biz Logic

1. In your favorite IDE create the `com.example.demo.domain` package
Copy link
Contributor

Choose a reason for hiding this comment

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

demo should be usagedetailsender. Based on the initializr instructions.

Copy link
Contributor

Choose a reason for hiding this comment

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

These changes need to be made globally in this sample.

You can run the standalone `UsageCostLogger` sink application as,

```
java -jar usage-cost-logger-0.0.1-SNAPSHOT.jar --spring.cloud.stream.bindings.input.destination=test-usage-cost --server.port=9092
Copy link
Contributor

Choose a reason for hiding this comment

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

app started and then stopped, using the instructions above.

Copy link
Collaborator

Choose a reason for hiding this comment

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

the pom has kafka in it as well....not rabbit. There needs to be another directory level, one for kafka, one for rabbit, stream-developer-guides/streams/standalone-stream-kafka and stream-developer-guides/streams/standalone-stream-rabbitmq

Copy link
Collaborator

Choose a reason for hiding this comment

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

Did you add the code from the biz logic step?

Copy link
Collaborator

Choose a reason for hiding this comment

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

The link for UsagecostDetail is also wrong.

Copy link
Contributor

Choose a reason for hiding this comment

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

yes.

package io.spring.dataflow.sample;

import io.spring.dataflow.sample.domain.UsageCostDetail;
import io.spring.dataflow.sample.domain.UsageDetail;

import org.springframework.cloud.stream.annotation.EnableBinding;
import org.springframework.cloud.stream.annotation.StreamListener;
import org.springframework.cloud.stream.messaging.Processor;
import org.springframework.messaging.handler.annotation.SendTo;

@EnableBinding(Processor.class)
public class UsageCostProcessor {

	private double ratePerSecond = 0.1;

	private double ratePerMB = 0.05;

	@StreamListener(Processor.INPUT)
	@SendTo(Processor.OUTPUT)
	public UsageCostDetail processUsageCost(UsageDetail usageDetail) {
		UsageCostDetail usageCostDetail = new UsageCostDetail();
		usageCostDetail.setUserId(usageDetail.getUserId());
		usageCostDetail.setCallCost(usageDetail.getDuration() * this.ratePerSecond);
		usageCostDetail.setDataCost(usageDetail.getData() * this.ratePerMB);
		return usageCostDetail;
	}
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I refactored the code by moving the package in Github but missed to update the link. will fix.


Another option instead of using the UI to initialize your project you can do the following:

1. Click the [here](https://start.spring.io/starter.zip?fakeusernameremembered=&fakepasswordremembered=&type=maven-project&language=java&bootVersion=2.1.4.RELEASE&baseDir=usage-detail-sender&groupId=io.spring.dataflow.sample&artifactId=usage-detail-sender&name=usage-detail-sender&description=Sample+project+for+Spring+Cloud+Stream+Source&packageName=io.spring.dataflow.sample&packaging=jar&javaVersion=1.8&inputSearch=&style=amqp&style=cloud-stream) to download the preconfigured usage-detail-sender.zip.
Copy link
Contributor

Choose a reason for hiding this comment

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

Link needs to be updated using kafka instead of AMQ.


#### Testing

We can individually test these custom applications before creating a pipeline using Spring Cloud Data Flow.
Copy link
Contributor

Choose a reason for hiding this comment

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

Needs to be updated for Kafka


1. Visit the [Spring Initialzr site](https://start.spring.io/).
1. Select the latest release of spring boot.
1. Create a new Maven project with a Group name of `com.example` and an Artifact name of `usage-cost-processor`.
Copy link
Contributor

Choose a reason for hiding this comment

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

com.example needs to be io.spring.dataflow.sample

@@ -0,0 +1,222 @@
---
path: 'stream-developer-guides/streams/standalone-stream-kafka/'
Copy link
Contributor

Choose a reason for hiding this comment

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

Update instructions to be Kafka instead of RabbitMQ.

@sabbyanandan sabbyanandan assigned markpollack and unassigned cppwfs Apr 30, 2019
@markpollack
Copy link
Collaborator

merged as 7cfa4f2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants