-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: adds init commit to migrate to public GH
- Loading branch information
0 parents
commit 8e4f3b5
Showing
27 changed files
with
1,060 additions
and
0 deletions.
There are no files selected for viewing
Validating CODEOWNERS rules …
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,10 @@ | ||
# List of source code paths and code owners | ||
# For more information on the CODEOWNERS file go to: | ||
# https://help.github.com/en/github/creating-cloning-and-archiving-repositories/about-code-owners#codeowners-syntax | ||
|
||
# Uncomment line 10 and add the correct owners's usernames. | ||
# These owners will be the default owners for everything in | ||
# the repo. Unless a later match takes precedence, | ||
# @global-owner1 and @global-owner2 will be requested for | ||
# review when someone opens a pull request. | ||
* @global-owner1 @global-owner2 |
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,15 @@ | ||
### Checklist | ||
🚨 Please review this repository's [contribution guidelines](./CONTRIBUTING.md). | ||
|
||
- [ ] I've read and agree to the project's contribution guidelines. | ||
- [ ] I'm requesting to **pull a topic/feature/bugfix branch**. | ||
- [ ] I checked that my code additions will pass code linting checks and unit tests. | ||
- [ ] I updated unit and integration tests (if applicable). | ||
- [ ] I'm ready to notify the team of this contribution. | ||
|
||
### Description | ||
What does this change do and why? | ||
|
||
[Link to JIRA] | ||
|
||
Thank you! |
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,24 @@ | ||
target/ | ||
!.mvn/wrapper/maven-wrapper.jar | ||
|
||
### STS ### | ||
.apt_generated | ||
.classpath | ||
.factorypath | ||
.project | ||
.settings | ||
.springBeans | ||
|
||
### IntelliJ IDEA ### | ||
.idea | ||
*.iws | ||
*.iml | ||
*.ipr | ||
|
||
### NetBeans ### | ||
nbproject/private/ | ||
build/ | ||
nbbuild/ | ||
dist/ | ||
nbdist/ | ||
.nb-gradle/ |
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,2 @@ | ||
# Change Log | ||
All notable changes to this project will be documented in this file. |
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,34 @@ | ||
Open source projects are “living.” Contributions in the form of issues and pull requests are welcomed and encouraged. | ||
When you contribute, you explicitly say you are part of the community and abide by its Code of Conduct. | ||
|
||
# The Code | ||
|
||
Intuit's Open Source community fosters a kind, respectful, harassment-free cooperative community. We strive to: | ||
|
||
- Be kind and respectful; | ||
- Act as a global community; | ||
- Conduct ourselves professionally. | ||
|
||
As members of this community, we will not tolerate behaviors including, but not limited to: | ||
|
||
- Violent threats or language; | ||
- Discriminatory or derogatory jokes or language; | ||
- Public or private harassment of any kind; | ||
- Other conduct considered inappropriate in a professional setting. | ||
|
||
## Reporting Concerns | ||
|
||
If you see someone violating the Code of Conduct please email TechOpenSource@intuit.com | ||
|
||
## Scope | ||
|
||
This code of conduct applies to: | ||
|
||
All repos and communities for Intuit-managed projects, whether the text is included in an Intuit-managed project’s repository; | ||
|
||
Individuals or teams representing projects in official capacity, such as via official social media channels or at in-person meetups. | ||
|
||
## Attribution | ||
|
||
This Code of Conduct is partly inspired by and based on those of Amazon, CocoaPods, GitHub, Microsoft, thoughtbot, | ||
and on the Contributor Covenant version 1.4.1. |
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,68 @@ | ||
Contribution Guidelines | ||
======================= | ||
Great to have you here. Whether it's improving documentation, adding a new component, or suggesting an issue that will help us improve, all contributions are welcome! | ||
|
||
- [Contribution Expectations](#Contribution-Expectations) | ||
- [Contribution Process](#Contribution-Process) | ||
- [After Contribution is Merged](#After-Contribution-is-Merged) | ||
- [Contact Information](#Contact-Information) | ||
|
||
## Contribution Expectations | ||
|
||
#### Adding Functionality or Reporting Bugs | ||
|
||
* You can look through the existing features/ bugs in the issues, if not please create a new issue. | ||
* Please note we have a code of conduct, please follow it in all your interactions with the project. | ||
|
||
#### Code Quality Expectations | ||
- Tests: All new Java methods should have correlated JUnit tests | ||
- Coverage: Ensure that code coverage does not fall below 80% | ||
- Documentation: Code should be well-documented. What code is doing should be self-explanatory based on coding conventions. Why code is doing something should be explained: | ||
* Java code should have JavaDoc | ||
* `pom.xml` should have comments | ||
* Unit tests should have comments and failure messages | ||
* Integration tests should have comments and failure messages | ||
- Code Style: We try to follow [Google's Coding Standards](https://google.github.io/styleguide/javaguide.html). It's easiest to format based on existing code you see. We don't enforce this; it's just a guideline | ||
|
||
#### SLAs | ||
The team that owns this repo is expected to practice the following: | ||
|
||
>The pull request review SLA is 7 days | ||
- Address any incoming PRs for contributions | ||
- Prioritize feature requests if handled by the team itself | ||
- Support the contributor through code guidance and contribution recognition | ||
|
||
|
||
|
||
## Contribution Process | ||
**All contributions should be done through a fork** | ||
|
||
1. Once the alignment is reached. Fork and Clone. From the GitHub UI, fork the project into your user space or another organization. | ||
2. Create a branch in your forked repo. | ||
3. Make your changes, including documentation. Writing good commit logs is important. Follow the [Local Development](./LOCAL_DEVELOPMENT.md) steps to get started. | ||
```text | ||
A commit log should describe what changed and why. | ||
Make sure that the commit message contains the Issue number. | ||
``` | ||
4. **Test**. Bug fixes and features **should come with tests** and coverage should meet or exceed 80%. Make sure all tests pass. Please do not submit patches that fail this check. | ||
|
||
5. Push your changes to your fork's branch. Use `git rebase` (not `git merge`) to sync your work from time to time. | ||
6. In GitHub, create a Pull Request to the upstream repository. On your forked repo, click the 'Pull Request' button and fill out the form. | ||
7. Making a PR will automatically trigger a series of checks against your changes. | ||
8. The team will reach out if they need more information or to make suggestions. | ||
|
||
|
||
[//]: # (after pr) | ||
|
||
## After Contribution is Merged | ||
|
||
Once the PR is good to go, the team will merge it, and you'll be credited as a contributor! Reach out to the team to follow their release cycle. These key questions can help you know what to expect: | ||
|
||
>- Are there ownership expectations in preprod/prod for a period of time? | ||
>- When can a contributor expect to see merged code built and deployed to preprod and prod? | ||
>- How can a contributor validate their code changes after changes have been deployed? | ||
|
||
## Contact Information | ||
|
||
* Need to get in contact with the team? The best people to start with are the project [code owners](./.github/CODEOWNERS). |
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,16 @@ | ||
# Local Development | ||
|
||
### Pre-requisites | ||
|
||
* Java 11 | ||
* Maven | ||
* Spring 5 Reactive Web Client | ||
|
||
## Steps | ||
|
||
1. Fork & Clone the repo. | ||
2. Make sure you are using java version 11. | ||
3. Download the dependencies: ```mvn clean install``` | ||
4. Make changes. | ||
5. Update the version in POM.xml | ||
6. Run ```mvn clean install``` to generate the jar locally for testing. |
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,19 @@ | ||
Copyright (c) 2019 Intuit | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. | ||
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, | ||
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR | ||
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE | ||
OR OTHER DEALINGS IN THE SOFTWARE. |
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,78 @@ | ||
# RWebPulse | ||
|
||
RWebPulse is a ready to consume JAR library to easily integrate your springboot project with the latest reactive web-client offered by the spring. It is a one stop solution with config based initialisations, exception and retry handling. | ||
|
||
|
||
## Who should use it? | ||
Any springboot application which requires downstream communication with different servers through rest/ graphql apis can leverage RWebPulse. | ||
|
||
|
||
## Why? | ||
The existing webclient cannot be integrated in an easy configurable manner with an existing application. The app user needs to make significant changes in their code to be able to leverage the benefits of webclient. | ||
|
||
With RWebPulse we are providing seamless config based integration to WebClient with support of exception and retry handling. All the http parameters can be configured at the runtime by the config. The existing application needs to make minimal changes by just providing the right config and directly consume the webclient. | ||
|
||
|
||
## How to integrate? | ||
|
||
|
||
### Adding the config | ||
|
||
Spring web client config needs to be defined like this in your application config. | ||
|
||
``` | ||
spring-web-client-config: | ||
connection-pool: # Connection pool configuration | ||
pending-acquire-timeout: 31000 # 31 seconds | ||
max-idle-time: 31000 # 31 seconds | ||
max-life-time: 300000 # 5 minutes | ||
max-connections: 400 # max pool connections | ||
http-client-config: # http client config | ||
connect-timeout-millis: 30000 # 30 seconds | ||
socket-timeout-millis: 30000 # 30 seconds | ||
``` | ||
|
||
|
||
|
||
| Property | Description | Default values | | ||
| ------ | ----------- | ------- | | ||
| connection-pool | | | | ||
| pending-acquire-timeout | Webclient fails if pool connection is pending for more than this duration | 31 seconds | | ||
| max-idle-time | max time connection can remain idle before the server closes | 31 seconds | | ||
| max-life-time | max life time of connection after which the server closes | 5 mins | | ||
| max-connections | max connections that can be maintained in the pool | 400 | | ||
| http-client-config | | | | ||
| connect-timeout-millis | a time period in which a client should establish a connection with a server | 30 seconds | | ||
| socket-timeout-millis | a maximum time of inactivity between two data packets when exchanging data with a server | 30 seconds | | ||
|
||
|
||
|
||
### Adding the client | ||
|
||
Add the below snippet in your application where you need to make a downstream service call | ||
|
||
``` | ||
private final CommonSpringWebClient webClient; | ||
protected ClientHttpResponse<Map> executeRequest(final Map<String, Object> body) { | ||
return webClient.syncHttpResponse( | ||
ClientHttpRequest.<Map, Map>builder() | ||
.url("https:abc.com/v1/create") | ||
.httpMethod(HttpMethod.POST) | ||
.requestHeaders(new HttpHeaders()) | ||
.request(body) | ||
.build()); | ||
} | ||
``` | ||
|
||
|
||
### Configure retries | ||
[Retry Handling](./RetryHandling.md) | ||
|
||
|
||
## [Contribution](./CONTRIBUTING.md) | ||
|
||
|
||
## Local Development | ||
[Local Development](./LOCAL_DEVELOPMENT.md) |
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,61 @@ | ||
# Retry Handling | ||
|
||
This library provides retry capabilites based on the runtime attributes as well as provides custom retry handling based on the response. | ||
|
||
Retry Config can be passed along with [ClientHttpRequest](./src/main/java/com/intuit/springwebclient/entity/ClientHttpRequest.java) | ||
|
||
``` | ||
webClient.syncHttpResponse( | ||
ClientHttpRequest.<Map, Map>builder() | ||
.url("https:abc.com/v1/create") | ||
.httpMethod(HttpMethod.POST) | ||
.requestHeaders(new HttpHeaders()) | ||
.request(body) | ||
.clientRetryConfig() | ||
.build()) | ||
``` | ||
|
||
### Client Retry Config | ||
|
||
[WebClientRetryConfig](./src/main/java/com/intuit/springwebclient/config/WebClientRetryConfig.java) | ||
|
||
| Attribute | Description | Default | | ||
| -------- | --------------------- | ---- | | ||
| maxAttempts | Maximum number of reties | 0 | | ||
| backOff | Backoff time between retries in seconds | 0 | | ||
|
||
### Custom Retry Handlers | ||
|
||
Custom retry handlers can be added, which would get invoked after exhaution of all reties specified in Client Retry Config. | ||
|
||
#### Steps | ||
|
||
1. Implement custom retry handler. [RetryHandler](./src/main/java/com/intuit/springwebclient/retryHandler/RetryHandler.java) | ||
2. Populate the Retry handler factory at the application start event. | ||
``` | ||
@Component | ||
@AllArgsConstructor | ||
public class ApplicationEventListener { | ||
private final List<RetryHandler> RetryHandler; | ||
@EventListener | ||
public void handleContextRefresh(ContextRefreshedEvent event) { | ||
// Init Retry Handler Factory | ||
RetryHandler.forEach( | ||
handler -> RetryHandlerFactory.addHandler(handler.getName(), handler)); | ||
} | ||
} | ||
``` | ||
3. Pass the list fo handlers to be called in the ClientHttpRequest. | ||
|
||
``` | ||
webClient.syncHttpResponse( | ||
ClientHttpRequest.<Map, Map>builder() | ||
.url("https:abc.com/v1/create") | ||
.httpMethod(HttpMethod.POST) | ||
.requestHeaders(new HttpHeaders()) | ||
.request(body) | ||
.retryHandlers() | ||
.build()) | ||
``` |
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,11 @@ | ||
# https://docs.codecov.io/docs/codecov-yaml | ||
codecov: | ||
branch: master | ||
coverage: | ||
status: | ||
patch: | ||
default: | ||
target: 75% | ||
|
||
comment: | ||
layout: "diff, flags, files:10, footer" |
Oops, something went wrong.