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

Add samples from camel pages #24

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

xlight05
Copy link

Purpose

$Subject

Goals

Describe the solutions that this feature/fix will introduce to resolve the problems described above

Approach

Describe how you are implementing the solutions. Include an animated GIF or screenshot if the change affects the UI (email [email protected] to review all UI text). Include a link to a Markdown file or Google doc if the feature write-up is too long to paste here.

User stories

Summary of user stories addressed by this change>

Release note

Brief description of the new feature or bug fix as it will appear in the release notes

Documentation

Link(s) to product documentation that addresses the changes of this PR. If no doc impact, enter “N/A” plus brief explanation of why there’s no doc impact

Training

Link to the PR for changes to the training content in https://github.com/wso2/WSO2-Training, if applicable

Certification

Type “Sent” when you have provided new/updated certification questions, plus four answers for each question (correct answer highlighted in bold), based on this change. Certification questions/answers should be sent to [email protected] and NOT pasted in this PR. If there is no impact on certification exams, type “N/A” and explain why.

Marketing

Link to drafts of marketing content that will describe and promote this feature, including product page changes, technical articles, blog posts, videos, etc., if applicable

Automation tests

  • Unit tests

    Code coverage information

  • Integration tests

    Details about the test cases and coverage

Security checks

Samples

Provide high-level details about the samples related to this feature

Related PRs

List any other related PRs

Migrations (if applicable)

Describe migration steps and platforms on which migration has been tested

Test environment

List all JDK versions, operating systems, databases, and browser/versions on which this feature/fix was tested

Learning

Describe the research phase and any blog posts, patterns, libraries, or add-ons you used to solve the problem.

string content;
};

Blog[] blogs = [];
Copy link

Choose a reason for hiding this comment

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

Suggested change
Blog[] blogs = [];
isolated Blog[] blogs = [];


configurable string slackToken = ?;

type Blog record {
Copy link

Choose a reason for hiding this comment

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

Suggested change
type Blog record {
type Blog record & readonly {

Blog[] blogs = [];

service /blog on new http:Listener(9090) {
slack:Client slackClient;
Copy link

Choose a reason for hiding this comment

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

Suggested change
slack:Client slackClient;
final slack:Client slackClient;

};
_ = check self.slackClient->postMessage(messageParams);
}
}
Copy link

Choose a reason for hiding this comment

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

Suggested change
}
}

@@ -0,0 +1,42 @@
import ballerina/http;
Copy link

Choose a reason for hiding this comment

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

Lets add a proper license header.


listener http:Listener helloEP = new(9090);

type Item record {
Copy link

Choose a reason for hiding this comment

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

Suggested change
type Item record {
type Item record & readonly {

Comment on lines +14 to +18
configurable string host = ?;
configurable int port = ?;
configurable string user = ?;
configurable string password = ?;
configurable string database = ?;
Copy link

Choose a reason for hiding this comment

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

});

service on orderListener {
private final kafka:Producer orderProducer;
Copy link

Choose a reason for hiding this comment

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

When declaring client inside a service, shall we follow a consistent approach ? (check for other places you have declared db-client, slack-client etc.)

topics: "payment_completed_topic"
});

map<int> inventory = {
Copy link

Choose a reason for hiding this comment

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

Suggested change
map<int> inventory = {
isolated map<int> inventory = {

import ballerinax/kafka;
import wso2/orders.types;

map<types:Order> ordersStore = {};
Copy link

Choose a reason for hiding this comment

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

Suggested change
map<types:Order> ordersStore = {};
isolated map<types:Order> ordersStore = {};

@@ -0,0 +1,36 @@
public type OrderRequest record {|
Copy link

Choose a reason for hiding this comment

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

Shall we mark the types as readonly ?

Suggested change
public type OrderRequest record {|
public type OrderRequest record & readonly {|

org = "wso2"
name = "orders.types"
version = "0.1.0"
repository = "local"
Copy link

Choose a reason for hiding this comment

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

Suggested change
repository = "local"
repository = "local"


foreach types:Order 'order in orders {
types:PaymentDetails paymentDetails = 'order.paymentDetails;
if (isPaymentValid(paymentDetails)) {
Copy link

Choose a reason for hiding this comment

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

Suggested change
if (isPaymentValid(paymentDetails)) {
if isPaymentValid(paymentDetails) {

maxTemp: day.maxtemp_c,
minTemp: day.mintemp_c
};
}
Copy link

Choose a reason for hiding this comment

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

Suggested change
}
}

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