├── soap-springws-learncamel-spring-boot
├── LOG_PATH_IS_UNDEFINED
│ └── camellog.log
├── .mvn
│ └── wrapper
│ │ ├── maven-wrapper.properties
│ │ └── maven-wrapper.jar
├── sql
│ └── application.sql
├── src
│ ├── main
│ │ ├── java
│ │ │ ├── net
│ │ │ │ └── webservicex
│ │ │ │ │ ├── package-info.java
│ │ │ │ │ ├── GetCountries.java
│ │ │ │ │ ├── GetCurrencies.java
│ │ │ │ │ ├── GetCurrencyCode.java
│ │ │ │ │ ├── GetISD.java
│ │ │ │ │ ├── GetGMTbyCountry.java
│ │ │ │ │ ├── GetISDResponse.java
│ │ │ │ │ ├── GetCurrencyByCountry.java
│ │ │ │ │ ├── GetCountryByCountryCode.java
│ │ │ │ │ ├── GetCountryByCurrencyCode.java
│ │ │ │ │ ├── GetISOCountryCodeByCountyName.java
│ │ │ │ │ ├── GetCurrencyCodeByCurrencyName.java
│ │ │ │ │ ├── GetCountriesResponse.java
│ │ │ │ │ ├── GetCurrenciesResponse.java
│ │ │ │ │ ├── GetCurrencyCodeResponse.java
│ │ │ │ │ ├── GetGMTbyCountryResponse.java
│ │ │ │ │ ├── GetCurrencyByCountryResponse.java
│ │ │ │ │ ├── GetCountryByCountryCodeResponse.java
│ │ │ │ │ ├── GetCountryByCurrencyCodeResponse.java
│ │ │ │ │ ├── GetCurrencyCodeByCurrencyNameResponse.java
│ │ │ │ │ └── GetISOCountryCodeByCountyNameResponse.java
│ │ │ └── com
│ │ │ │ └── learncamel
│ │ │ │ ├── exception
│ │ │ │ └── DataException.java
│ │ │ │ ├── SoapCamelApplication.java
│ │ │ │ ├── config
│ │ │ │ ├── DBConfig.java
│ │ │ │ └── SoapConfig.java
│ │ │ │ ├── domain
│ │ │ │ └── Country.java
│ │ │ │ ├── processor
│ │ │ │ ├── BuildSQLProcessor.java
│ │ │ │ ├── RequestXMLBuildProcessor.java
│ │ │ │ └── HealthCheckProcessor.java
│ │ │ │ ├── routes
│ │ │ │ └── HealthCheckRoute.java
│ │ │ │ └── alert
│ │ │ │ └── MailProcessor.java
│ │ └── resources
│ │ │ └── logback.xml
│ └── test
│ │ └── java
│ │ └── com
│ │ └── learncamel
│ │ └── routes
│ │ ├── SoapCamelRouteTest.java
│ │ └── HealthCheckMockTest.java
├── README.md
└── .gitignore
├── learncamel-spring-boot
├── datafile
│ ├── fileDelete.txt
│ └── fileUpdate.txt
├── data
│ └── input
│ │ └── fileAdd.txt
├── .mvn
│ └── wrapper
│ │ ├── maven-wrapper.properties
│ │ └── maven-wrapper.jar
├── sql
│ └── Application.sql
├── src
│ ├── main
│ │ ├── java
│ │ │ └── com
│ │ │ │ └── learncamel
│ │ │ │ ├── exception
│ │ │ │ └── DataException.java
│ │ │ │ ├── LearncamelSpringBootApplication.java
│ │ │ │ ├── processor
│ │ │ │ ├── SuccessMessageProcessor.java
│ │ │ │ ├── BuildSQLProcessor.java
│ │ │ │ └── HealthCheckProcessor.java
│ │ │ │ ├── config
│ │ │ │ └── DBConfig.java
│ │ │ │ ├── alert
│ │ │ │ └── MailProcessor.java
│ │ │ │ ├── routes
│ │ │ │ └── HealthCheckRoute.java
│ │ │ │ └── domain
│ │ │ │ └── Item.java
│ │ └── resources
│ │ │ └── logback.xml
│ └── test
│ │ └── java
│ │ └── com
│ │ └── learncamel
│ │ └── routes
│ │ └── HealthRouteMockTest.java
├── .gitignore
└── README.md
├── simple-rest-api
├── .mvn
│ └── wrapper
│ │ ├── maven-wrapper.properties
│ │ └── maven-wrapper.jar
├── src
│ ├── main
│ │ ├── resources
│ │ │ └── application.yml
│ │ └── java
│ │ │ └── com
│ │ │ └── learnspringboot
│ │ │ ├── SimpleRestApiApplication.java
│ │ │ ├── controller
│ │ │ └── CurrentTimeController.java
│ │ │ └── service
│ │ │ └── CurrentTimeService.java
│ └── test
│ │ └── java
│ │ └── com
│ │ └── learnspringboot
│ │ └── SimpleRestApiApplicationTests.java
├── .gitignore
└── pom.xml
├── activemq-learncamel-spring-boot
├── .mvn
│ └── wrapper
│ │ ├── maven-wrapper.properties
│ │ └── maven-wrapper.jar
├── src
│ ├── main
│ │ ├── java
│ │ │ └── com
│ │ │ │ └── learncamel
│ │ │ │ ├── exception
│ │ │ │ └── DataException.java
│ │ │ │ ├── ActiveMQCamelApplication.java
│ │ │ │ ├── config
│ │ │ │ ├── ActiveMQConfig.java
│ │ │ │ └── DBConfig.java
│ │ │ │ ├── processor
│ │ │ │ ├── ValidateDataProcessor.java
│ │ │ │ ├── BuildSQLProcessor.java
│ │ │ │ └── HealthCheckProcessor.java
│ │ │ │ ├── routes
│ │ │ │ ├── HealthCheckRoute.java
│ │ │ │ └── ActiveMQRoute.java
│ │ │ │ ├── alert
│ │ │ │ └── MailProcessor.java
│ │ │ │ └── domain
│ │ │ │ └── Item.java
│ │ └── resources
│ │ │ └── logback.xml
│ └── test
│ │ └── java
│ │ └── com
│ │ └── learncamel
│ │ └── routes
│ │ ├── SimpleCamelRouteMockTest.java
│ │ ├── ActiveMQRouteTest.java
│ │ └── HealthCheckMockTest.java
├── .gitignore
├── README.md
└── data
│ └── input
├── camel-spring-boot-boiler-plate
├── .mvn
│ └── wrapper
│ │ ├── maven-wrapper.properties
│ │ └── maven-wrapper.jar
├── src
│ ├── main
│ │ ├── java
│ │ │ └── com
│ │ │ │ └── learncamel
│ │ │ │ ├── exception
│ │ │ │ └── DataException.java
│ │ │ │ ├── CamelSpringBoilerPlateApplication.java
│ │ │ │ ├── config
│ │ │ │ └── DBConfig.java
│ │ │ │ ├── routes
│ │ │ │ ├── HealthCheckRoute.java
│ │ │ │ └── SimpleCamelRoute.java
│ │ │ │ ├── alert
│ │ │ │ └── MailProcessor.java
│ │ │ │ └── processor
│ │ │ │ └── HealthCheckProcessor.java
│ │ └── resources
│ │ │ ├── logback.xml
│ │ │ └── application.yml
│ └── test
│ │ └── java
│ │ └── com
│ │ └── learncamel
│ │ └── routes
│ │ ├── SimpleCamelRouteMockTest.java
│ │ ├── SimpleCamelRouteTest.java
│ │ └── HealthCheckMockTest.java
├── README.md
└── .gitignore
├── kafka-learncamel-spring-boot
├── .mvn
│ └── wrapper
│ │ ├── maven-wrapper.properties
│ │ └── maven-wrapper.jar
├── src
│ ├── main
│ │ ├── java
│ │ │ └── com
│ │ │ │ └── learncamel
│ │ │ │ ├── exception
│ │ │ │ └── DataException.java
│ │ │ │ ├── KafkaCamelApplication.java
│ │ │ │ ├── config
│ │ │ │ └── DBConfig.java
│ │ │ │ ├── processor
│ │ │ │ ├── ValidateDataProcessor.java
│ │ │ │ ├── BuildSQLProcessor.java
│ │ │ │ └── HealthCheckProcessor.java
│ │ │ │ ├── routes
│ │ │ │ ├── HealthCheckRoute.java
│ │ │ │ └── KafkaRoute.java
│ │ │ │ ├── alert
│ │ │ │ └── MailProcessor.java
│ │ │ │ └── domain
│ │ │ │ └── Item.java
│ │ └── resources
│ │ │ └── logback.xml
│ └── test
│ │ └── java
│ │ └── com
│ │ └── learncamel
│ │ └── routes
│ │ ├── HealthCheckMockTest.java
│ │ └── KafkaRouteMockTest.java
├── .gitignore
├── README.md
└── data
│ └── input
├── rest-learncamel-spring-boot
├── .mvn
│ └── wrapper
│ │ ├── maven-wrapper.properties
│ │ └── maven-wrapper.jar
├── sql
│ └── application.sql
├── src
│ ├── main
│ │ ├── java
│ │ │ └── com
│ │ │ │ └── learncamel
│ │ │ │ ├── exception
│ │ │ │ └── DataException.java
│ │ │ │ ├── RestCamelApplication.java
│ │ │ │ ├── service
│ │ │ │ └── CountryService.java
│ │ │ │ ├── config
│ │ │ │ └── DBConfig.java
│ │ │ │ ├── processor
│ │ │ │ ├── CountrySelectProcessor.java
│ │ │ │ ├── BuildSQLProcessor.java
│ │ │ │ └── HealthCheckProcessor.java
│ │ │ │ ├── domain
│ │ │ │ └── Country.java
│ │ │ │ ├── routes
│ │ │ │ ├── HealthCheckRoute.java
│ │ │ │ ├── RestCamelRoute.java
│ │ │ │ └── CountryRestRoute.java
│ │ │ │ └── alert
│ │ │ │ └── MailProcessor.java
│ │ └── resources
│ │ │ ├── logback.xml
│ │ │ └── application.yml
│ └── test
│ │ └── java
│ │ └── com
│ │ └── learncamel
│ │ └── routes
│ │ ├── SimpleCamelRouteMockTest.java
│ │ ├── SimpleCamelRouteTest.java
│ │ └── HealthCheckMockTest.java
├── .gitignore
└── README.md
├── rest-learncamel-spring-boot-with-mockito
├── .mvn
│ └── wrapper
│ │ ├── maven-wrapper.properties
│ │ └── maven-wrapper.jar
├── sql
│ └── application.sql
├── src
│ ├── main
│ │ ├── java
│ │ │ └── com
│ │ │ │ └── learncamel
│ │ │ │ ├── exception
│ │ │ │ └── DataException.java
│ │ │ │ ├── RestCamelApplication.java
│ │ │ │ ├── config
│ │ │ │ ├── ApplicationConfig.java
│ │ │ │ └── DBConfig.java
│ │ │ │ ├── processor
│ │ │ │ ├── CountrySelectProcessor.java
│ │ │ │ ├── BuildSQLProcessor.java
│ │ │ │ └── HealthCheckProcessor.java
│ │ │ │ ├── service
│ │ │ │ └── CountryService.java
│ │ │ │ ├── domain
│ │ │ │ └── Country.java
│ │ │ │ ├── routes
│ │ │ │ ├── HealthCheckRoute.java
│ │ │ │ ├── RestCamelRoute.java
│ │ │ │ └── CountryRestRoute.java
│ │ │ │ └── alert
│ │ │ │ └── MailProcessor.java
│ │ └── resources
│ │ │ └── logback.xml
│ └── test
│ │ └── java
│ │ └── com
│ │ └── learncamel
│ │ └── routes
│ │ ├── service
│ │ ├── CountryServiceTest.java
│ │ └── CountriesMockTest.java
│ │ ├── SimpleCamelRouteMockTest.java
│ │ ├── SimpleCamelRouteTest.java
│ │ └── HealthCheckMockTest.java
├── .gitignore
└── README.md
├── set-up
├── How-to-download:run-activemq.md
├── How-to-install-Postgres-in-Windows.md
└── How-to-install-Postgres-in-Mac.md
└── README.md
/soap-springws-learncamel-spring-boot/LOG_PATH_IS_UNDEFINED/camellog.log:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/learncamel-spring-boot/datafile/fileDelete.txt:
--------------------------------------------------------------------------------
1 | type,sku#,item description,price
2 | DELETE,100,Samsung TV,500.00
--------------------------------------------------------------------------------
/learncamel-spring-boot/datafile/fileUpdate.txt:
--------------------------------------------------------------------------------
1 | type,sku#,item description,price
2 | UPDATE,100,Samsung TV,600.00
--------------------------------------------------------------------------------
/learncamel-spring-boot/data/input/fileAdd.txt:
--------------------------------------------------------------------------------
1 | type,sku#,item description,price
2 | ADD,100,Samsung TV,500.00
3 | ADD,101,LG TV,300.00
4 | ADD,,Sony TV,300.00
--------------------------------------------------------------------------------
/simple-rest-api/.mvn/wrapper/maven-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.5.2/apache-maven-3.5.2-bin.zip
2 |
--------------------------------------------------------------------------------
/simple-rest-api/.mvn/wrapper/maven-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dilipsundarraj1/TeachApacheCamel-Spring-Boot/HEAD/simple-rest-api/.mvn/wrapper/maven-wrapper.jar
--------------------------------------------------------------------------------
/learncamel-spring-boot/.mvn/wrapper/maven-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.5.2/apache-maven-3.5.2-bin.zip
2 |
--------------------------------------------------------------------------------
/activemq-learncamel-spring-boot/.mvn/wrapper/maven-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.5.2/apache-maven-3.5.2-bin.zip
2 |
--------------------------------------------------------------------------------
/camel-spring-boot-boiler-plate/.mvn/wrapper/maven-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.5.2/apache-maven-3.5.2-bin.zip
2 |
--------------------------------------------------------------------------------
/kafka-learncamel-spring-boot/.mvn/wrapper/maven-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.5.2/apache-maven-3.5.2-bin.zip
2 |
--------------------------------------------------------------------------------
/rest-learncamel-spring-boot/.mvn/wrapper/maven-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.5.2/apache-maven-3.5.2-bin.zip
2 |
--------------------------------------------------------------------------------
/learncamel-spring-boot/.mvn/wrapper/maven-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dilipsundarraj1/TeachApacheCamel-Spring-Boot/HEAD/learncamel-spring-boot/.mvn/wrapper/maven-wrapper.jar
--------------------------------------------------------------------------------
/soap-springws-learncamel-spring-boot/.mvn/wrapper/maven-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.5.2/apache-maven-3.5.2-bin.zip
2 |
--------------------------------------------------------------------------------
/rest-learncamel-spring-boot-with-mockito/.mvn/wrapper/maven-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.5.2/apache-maven-3.5.2-bin.zip
2 |
--------------------------------------------------------------------------------
/kafka-learncamel-spring-boot/.mvn/wrapper/maven-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dilipsundarraj1/TeachApacheCamel-Spring-Boot/HEAD/kafka-learncamel-spring-boot/.mvn/wrapper/maven-wrapper.jar
--------------------------------------------------------------------------------
/rest-learncamel-spring-boot/.mvn/wrapper/maven-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dilipsundarraj1/TeachApacheCamel-Spring-Boot/HEAD/rest-learncamel-spring-boot/.mvn/wrapper/maven-wrapper.jar
--------------------------------------------------------------------------------
/camel-spring-boot-boiler-plate/.mvn/wrapper/maven-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dilipsundarraj1/TeachApacheCamel-Spring-Boot/HEAD/camel-spring-boot-boiler-plate/.mvn/wrapper/maven-wrapper.jar
--------------------------------------------------------------------------------
/activemq-learncamel-spring-boot/.mvn/wrapper/maven-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dilipsundarraj1/TeachApacheCamel-Spring-Boot/HEAD/activemq-learncamel-spring-boot/.mvn/wrapper/maven-wrapper.jar
--------------------------------------------------------------------------------
/soap-springws-learncamel-spring-boot/.mvn/wrapper/maven-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dilipsundarraj1/TeachApacheCamel-Spring-Boot/HEAD/soap-springws-learncamel-spring-boot/.mvn/wrapper/maven-wrapper.jar
--------------------------------------------------------------------------------
/soap-springws-learncamel-spring-boot/sql/application.sql:
--------------------------------------------------------------------------------
1 | CREATE TABLE COUNTRIES(
2 | COUNTRY_I SERIAL,
3 | NAME TEXT,
4 | COUNTRY_CODE TEXT,
5 | CRTE_TS TIMESTAMPTZ NULL default current_timestamp
6 | );
--------------------------------------------------------------------------------
/rest-learncamel-spring-boot-with-mockito/.mvn/wrapper/maven-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dilipsundarraj1/TeachApacheCamel-Spring-Boot/HEAD/rest-learncamel-spring-boot-with-mockito/.mvn/wrapper/maven-wrapper.jar
--------------------------------------------------------------------------------
/rest-learncamel-spring-boot/sql/application.sql:
--------------------------------------------------------------------------------
1 | CREATE TABLE COUNTRY(
2 | COUNTRY_I SERIAL,
3 | NAME TEXT,
4 | COUNTRY_CODE TEXT,
5 | POPULATION NUMERIC,
6 | CRTE_TS TIMESTAMPTZ NULL default current_timestamp
7 | );
--------------------------------------------------------------------------------
/rest-learncamel-spring-boot-with-mockito/sql/application.sql:
--------------------------------------------------------------------------------
1 | CREATE TABLE COUNTRY(
2 | COUNTRY_I SERIAL,
3 | NAME TEXT,
4 | COUNTRY_CODE TEXT,
5 | POPULATION NUMERIC,
6 | CRTE_TS TIMESTAMPTZ NULL default current_timestamp
7 | );
--------------------------------------------------------------------------------
/learncamel-spring-boot/sql/Application.sql:
--------------------------------------------------------------------------------
1 | DROP TABLE ITEMS;
2 |
3 | CREATE TABLE ITEMS(
4 | ITEM_I SERIAL,
5 | SKU TEXT NOT NULL,
6 | ITEM_DESCRIPTION TEXT DEFAULT NULL,
7 | PRICE NUMERIC (5, 2),
8 | CRTE_TS TIMESTAMPTZ NULL default current_timestamp
9 | );
--------------------------------------------------------------------------------
/soap-springws-learncamel-spring-boot/src/main/java/net/webservicex/package-info.java:
--------------------------------------------------------------------------------
1 | @javax.xml.bind.annotation.XmlSchema(namespace = "http://www.webserviceX.NET", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED)
2 | package net.webservicex;
3 |
--------------------------------------------------------------------------------
/learncamel-spring-boot/src/main/java/com/learncamel/exception/DataException.java:
--------------------------------------------------------------------------------
1 | package com.learncamel.exception;
2 |
3 | /**
4 | * Created by Dilip on 1/21/18.
5 | */
6 | public class DataException extends RuntimeException {
7 |
8 | public DataException( String message) {
9 | super( message);
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/rest-learncamel-spring-boot/src/main/java/com/learncamel/exception/DataException.java:
--------------------------------------------------------------------------------
1 | package com.learncamel.exception;
2 |
3 | /**
4 | * Created by Dilip on 1/21/18.
5 | */
6 | public class DataException extends RuntimeException {
7 |
8 | public DataException( String message) {
9 | super( message);
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/activemq-learncamel-spring-boot/src/main/java/com/learncamel/exception/DataException.java:
--------------------------------------------------------------------------------
1 | package com.learncamel.exception;
2 |
3 | /**
4 | * Created by Dilip on 1/21/18.
5 | */
6 | public class DataException extends RuntimeException {
7 |
8 | public DataException( String message) {
9 | super( message);
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/camel-spring-boot-boiler-plate/src/main/java/com/learncamel/exception/DataException.java:
--------------------------------------------------------------------------------
1 | package com.learncamel.exception;
2 |
3 | /**
4 | * Created by Dilip on 1/21/18.
5 | */
6 | public class DataException extends RuntimeException {
7 |
8 | public DataException( String message) {
9 | super( message);
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/kafka-learncamel-spring-boot/src/main/java/com/learncamel/exception/DataException.java:
--------------------------------------------------------------------------------
1 | package com.learncamel.exception;
2 |
3 | /**
4 | * Created by Dilip on 1/21/18.
5 | */
6 | public class DataException extends RuntimeException {
7 |
8 | public DataException( String message) {
9 | super( message);
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/soap-springws-learncamel-spring-boot/src/main/java/com/learncamel/exception/DataException.java:
--------------------------------------------------------------------------------
1 | package com.learncamel.exception;
2 |
3 | /**
4 | * Created by Dilip on 1/21/18.
5 | */
6 | public class DataException extends RuntimeException {
7 |
8 | public DataException( String message) {
9 | super( message);
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/rest-learncamel-spring-boot-with-mockito/src/main/java/com/learncamel/exception/DataException.java:
--------------------------------------------------------------------------------
1 | package com.learncamel.exception;
2 |
3 | /**
4 | * Created by Dilip on 1/21/18.
5 | */
6 | public class DataException extends RuntimeException {
7 |
8 | public DataException( String message) {
9 | super( message);
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/simple-rest-api/src/main/resources/application.yml:
--------------------------------------------------------------------------------
1 | spring:
2 | profiles:
3 | active: dev
4 |
5 | ---
6 | spring:
7 | profiles: dev
8 |
9 | message: Hello from DEV environment and the current time is
10 |
11 |
12 | ---
13 | spring:
14 | profiles: prod
15 |
16 | message: Hello from PROD environment and the current time is
17 |
18 | ---
--------------------------------------------------------------------------------
/simple-rest-api/.gitignore:
--------------------------------------------------------------------------------
1 | target/
2 | !.mvn/wrapper/maven-wrapper.jar
3 |
4 | ### STS ###
5 | .apt_generated
6 | .classpath
7 | .factorypath
8 | .project
9 | .settings
10 | .springBeans
11 |
12 | ### IntelliJ IDEA ###
13 | .idea
14 | *.iws
15 | *.iml
16 | *.ipr
17 |
18 | ### NetBeans ###
19 | nbproject/private/
20 | build/
21 | nbbuild/
22 | dist/
23 | nbdist/
24 | .nb-gradle/
--------------------------------------------------------------------------------
/camel-spring-boot-boiler-plate/README.md:
--------------------------------------------------------------------------------
1 | # camel-spring-boot-boiler-plate
2 | Boiler Plate Code for building Camel Spring Boot Projects
3 |
4 | This code base is bundled with the following:
5 |
6 | - Lombok - application logging
7 | - jdbc - Postgres DB configuration
8 | - Email - Email configuration
9 | - Application Health Check Configuration.
10 | - Camel Spring Boot Testing Libraries.
--------------------------------------------------------------------------------
/soap-springws-learncamel-spring-boot/README.md:
--------------------------------------------------------------------------------
1 | # camel-spring-boot-boiler-plate
2 | Boiler Plate Code for building Camel Spring Boot Projects
3 |
4 | This code base is bundled with the following:
5 |
6 | - Lombok - application logging
7 | - jdbc - Postgres DB configuration
8 | - Email - Email configuration
9 | - Application Health Check Configuration.
10 | - Camel Spring Boot Testing Libraries.
--------------------------------------------------------------------------------
/learncamel-spring-boot/.gitignore:
--------------------------------------------------------------------------------
1 | target/
2 | !.mvn/wrapper/maven-wrapper.jar
3 |
4 | ### STS ###
5 | .apt_generated
6 | .classpath
7 | .factorypath
8 | .project
9 | .settings
10 | .springBeans
11 |
12 | ### IntelliJ IDEA ###
13 | .idea
14 | *.iws
15 | *.iml
16 | *.ipr
17 |
18 |
19 | ### NetBeans ###
20 | nbproject/private/
21 | build/
22 | nbbuild/
23 | dist/
24 | nbdist/
25 | .nb-gradle/
26 | /logs
27 |
--------------------------------------------------------------------------------
/kafka-learncamel-spring-boot/.gitignore:
--------------------------------------------------------------------------------
1 | target/
2 | !.mvn/wrapper/maven-wrapper.jar
3 |
4 | ### STS ###
5 | .apt_generated
6 | .classpath
7 | .factorypath
8 | .project
9 | .settings
10 | .springBeans
11 |
12 | ### IntelliJ IDEA ###
13 | .idea
14 | *.iws
15 | *.iml
16 | *.ipr
17 |
18 |
19 | ### NetBeans ###
20 | nbproject/private/
21 | build/
22 | nbbuild/
23 | dist/
24 | nbdist/
25 | .nb-gradle/
26 | /logs
27 |
--------------------------------------------------------------------------------
/rest-learncamel-spring-boot/.gitignore:
--------------------------------------------------------------------------------
1 | target/
2 | !.mvn/wrapper/maven-wrapper.jar
3 |
4 | ### STS ###
5 | .apt_generated
6 | .classpath
7 | .factorypath
8 | .project
9 | .settings
10 | .springBeans
11 |
12 | ### IntelliJ IDEA ###
13 | .idea
14 | *.iws
15 | *.iml
16 | *.ipr
17 |
18 |
19 | ### NetBeans ###
20 | nbproject/private/
21 | build/
22 | nbbuild/
23 | dist/
24 | nbdist/
25 | .nb-gradle/
26 | /logs
27 |
--------------------------------------------------------------------------------
/activemq-learncamel-spring-boot/.gitignore:
--------------------------------------------------------------------------------
1 | target/
2 | !.mvn/wrapper/maven-wrapper.jar
3 |
4 | ### STS ###
5 | .apt_generated
6 | .classpath
7 | .factorypath
8 | .project
9 | .settings
10 | .springBeans
11 |
12 | ### IntelliJ IDEA ###
13 | .idea
14 | *.iws
15 | *.iml
16 | *.ipr
17 |
18 |
19 | ### NetBeans ###
20 | nbproject/private/
21 | build/
22 | nbbuild/
23 | dist/
24 | nbdist/
25 | .nb-gradle/
26 | /logs
27 |
--------------------------------------------------------------------------------
/camel-spring-boot-boiler-plate/.gitignore:
--------------------------------------------------------------------------------
1 | target/
2 | !.mvn/wrapper/maven-wrapper.jar
3 |
4 | ### STS ###
5 | .apt_generated
6 | .classpath
7 | .factorypath
8 | .project
9 | .settings
10 | .springBeans
11 |
12 | ### IntelliJ IDEA ###
13 | .idea
14 | *.iws
15 | *.iml
16 | *.ipr
17 |
18 |
19 | ### NetBeans ###
20 | nbproject/private/
21 | build/
22 | nbbuild/
23 | dist/
24 | nbdist/
25 | .nb-gradle/
26 | /logs
27 |
--------------------------------------------------------------------------------
/soap-springws-learncamel-spring-boot/.gitignore:
--------------------------------------------------------------------------------
1 | target/
2 | !.mvn/wrapper/maven-wrapper.jar
3 |
4 | ### STS ###
5 | .apt_generated
6 | .classpath
7 | .factorypath
8 | .project
9 | .settings
10 | .springBeans
11 |
12 | ### IntelliJ IDEA ###
13 | .idea
14 | *.iws
15 | *.iml
16 | *.ipr
17 |
18 |
19 | ### NetBeans ###
20 | nbproject/private/
21 | build/
22 | nbbuild/
23 | dist/
24 | nbdist/
25 | .nb-gradle/
26 | /logs
27 |
--------------------------------------------------------------------------------
/rest-learncamel-spring-boot-with-mockito/.gitignore:
--------------------------------------------------------------------------------
1 | target/
2 | !.mvn/wrapper/maven-wrapper.jar
3 |
4 | ### STS ###
5 | .apt_generated
6 | .classpath
7 | .factorypath
8 | .project
9 | .settings
10 | .springBeans
11 |
12 | ### IntelliJ IDEA ###
13 | .idea
14 | *.iws
15 | *.iml
16 | *.ipr
17 |
18 |
19 | ### NetBeans ###
20 | nbproject/private/
21 | build/
22 | nbbuild/
23 | dist/
24 | nbdist/
25 | .nb-gradle/
26 | /logs
27 |
--------------------------------------------------------------------------------
/kafka-learncamel-spring-boot/README.md:
--------------------------------------------------------------------------------
1 | # kafka-learncamel-spring-boot
2 | This code base has the working code to connect to the Kafka
3 |
4 | This code base is bundled with the following:
5 |
6 | - Lombok - application logging
7 | - jdbc - Postgres DB configuration
8 | - Email - Email configuration
9 | - Application Health Check Configuration.
10 | - Camel Spring Boot Testing Libraries.
11 | - Kafka Configuration
12 |
--------------------------------------------------------------------------------
/learncamel-spring-boot/README.md:
--------------------------------------------------------------------------------
1 | # learncamel-spring-boot
2 | This code base has the working code to connect to the File component
3 |
4 | This code base is bundled with the following:
5 |
6 | - Lombok - application logging
7 | - jdbc - Postgres DB configuration
8 | - Email - Email configuration
9 | - Application Health Check Configuration.
10 | - Camel Spring Boot Testing Libraries.
11 | - File/Folder Configuration
12 |
--------------------------------------------------------------------------------
/activemq-learncamel-spring-boot/README.md:
--------------------------------------------------------------------------------
1 | # activemq-learncamel-spring-boot
2 | This code base has the working code to connect to the REST API
3 |
4 | This code base is bundled with the following:
5 |
6 | - Lombok - application logging
7 | - jdbc - Postgres DB configuration
8 | - Email - Email configuration
9 | - Application Health Check Configuration.
10 | - Camel Spring Boot Testing Libraries.
11 | - ActiveMQ Configuration
12 |
--------------------------------------------------------------------------------
/rest-learncamel-spring-boot/src/main/java/com/learncamel/RestCamelApplication.java:
--------------------------------------------------------------------------------
1 | package com.learncamel;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 |
6 | @SpringBootApplication
7 | public class RestCamelApplication {
8 |
9 | public static void main(String[] args) {
10 | SpringApplication.run(RestCamelApplication.class, args);
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/kafka-learncamel-spring-boot/src/main/java/com/learncamel/KafkaCamelApplication.java:
--------------------------------------------------------------------------------
1 | package com.learncamel;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 |
6 | @SpringBootApplication
7 | public class KafkaCamelApplication {
8 |
9 | public static void main(String[] args) {
10 | SpringApplication.run(KafkaCamelApplication.class, args);
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/rest-learncamel-spring-boot-with-mockito/src/main/java/com/learncamel/RestCamelApplication.java:
--------------------------------------------------------------------------------
1 | package com.learncamel;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 |
6 | @SpringBootApplication
7 | public class RestCamelApplication {
8 |
9 | public static void main(String[] args) {
10 | SpringApplication.run(RestCamelApplication.class, args);
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/simple-rest-api/src/main/java/com/learnspringboot/SimpleRestApiApplication.java:
--------------------------------------------------------------------------------
1 | package com.learnspringboot;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 |
6 | @SpringBootApplication
7 | public class SimpleRestApiApplication {
8 |
9 | public static void main(String[] args) {
10 | SpringApplication.run(SimpleRestApiApplication.class, args);
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/rest-learncamel-spring-boot/src/main/java/com/learncamel/service/CountryService.java:
--------------------------------------------------------------------------------
1 | package com.learncamel.service;
2 |
3 | import org.springframework.stereotype.Component;
4 |
5 | import java.time.LocalDateTime;
6 |
7 | @Component
8 | public class CountryService {
9 |
10 | public String getCurrentDateTime(){
11 |
12 | LocalDateTime localDateTime = LocalDateTime.now();
13 | return localDateTime.toString();
14 | }
15 |
16 | }
17 |
--------------------------------------------------------------------------------
/soap-springws-learncamel-spring-boot/src/main/java/com/learncamel/SoapCamelApplication.java:
--------------------------------------------------------------------------------
1 | package com.learncamel;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 |
6 | @SpringBootApplication
7 | public class SoapCamelApplication {
8 |
9 | public static void main(String[] args) {
10 | SpringApplication.run(SoapCamelApplication.class, args);
11 |
12 | }
13 |
14 | }
15 |
--------------------------------------------------------------------------------
/learncamel-spring-boot/src/main/java/com/learncamel/LearncamelSpringBootApplication.java:
--------------------------------------------------------------------------------
1 | package com.learncamel;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 |
6 | @SpringBootApplication
7 | public class LearncamelSpringBootApplication {
8 |
9 | public static void main(String[] args) {
10 | SpringApplication.run(LearncamelSpringBootApplication.class, args);
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/rest-learncamel-spring-boot/README.md:
--------------------------------------------------------------------------------
1 | # rest-learncamel-spring-boot
2 | This code base has the working code to connect to the Kafka
3 |
4 | This code base is bundled with the following:
5 |
6 | - Lombok - application logging
7 | - jdbc - Postgres DB configuration
8 | - Email - Email configuration
9 | - Application Health Check Configuration.
10 | - Camel Spring Boot Testing Libraries.
11 | - Kafka Configuration
12 | - Rest/Restlet Configuration
13 |
--------------------------------------------------------------------------------
/rest-learncamel-spring-boot-with-mockito/README.md:
--------------------------------------------------------------------------------
1 | # rest-learncamel-spring-boot
2 | This code base has the working code to connect to the Kafka
3 |
4 | This code base is bundled with the following:
5 |
6 | - Lombok - application logging
7 | - jdbc - Postgres DB configuration
8 | - Email - Email configuration
9 | - Application Health Check Configuration.
10 | - Camel Spring Boot Testing Libraries.
11 | - Kafka Configuration
12 | - Rest/Restlet Configuration
13 |
--------------------------------------------------------------------------------
/camel-spring-boot-boiler-plate/src/main/java/com/learncamel/CamelSpringBoilerPlateApplication.java:
--------------------------------------------------------------------------------
1 | package com.learncamel;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 |
6 | @SpringBootApplication
7 | public class CamelSpringBoilerPlateApplication {
8 |
9 | public static void main(String[] args) {
10 | SpringApplication.run(CamelSpringBoilerPlateApplication.class, args);
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/kafka-learncamel-spring-boot/data/input:
--------------------------------------------------------------------------------
1 | {"transactionType":"ADD", "sku":"100", "itemDescription":"SamsungTV", "price":"500.00"}
2 | {"transactionType":"ADD", "sku":"101", "itemDescription":"LG TV", "price":"500.00"}
3 | {"transactionType":"UPDATE", "sku":"101", "itemDescription":"LG TV", "price":"700.00"}
4 | {"transactionType":"DELETE", "sku":"101", "itemDescription":"LG TV", "price":"500"}
5 |
6 | --Error
7 | {"transactionType":"ADD", "sku":"", "itemDescription":"ABC TV", "price":"500.00"}
--------------------------------------------------------------------------------
/activemq-learncamel-spring-boot/data/input:
--------------------------------------------------------------------------------
1 | {"transactionType":"ADD", "sku":"100", "itemDescription":"SamsungTV", "price":"500.00"}
2 | {"transactionType":"ADD", "sku":"101", "itemDescription":"LG TV", "price":"500.00"}
3 | {"transactionType":"UPDATE", "sku":"101", "itemDescription":"LG TV", "price":"700.00"}
4 | {"transactionType":"DELETE", "sku":"101", "itemDescription":"LG TV", "price":"500"}
5 |
6 | --Error
7 | {"transactionType":"ADD", "sku":"", "itemDescription":"ABC TV", "price":"500.00"}
--------------------------------------------------------------------------------
/simple-rest-api/src/test/java/com/learnspringboot/SimpleRestApiApplicationTests.java:
--------------------------------------------------------------------------------
1 | package com.learnspringboot;
2 |
3 | import org.junit.Test;
4 | import org.junit.runner.RunWith;
5 | import org.springframework.boot.test.context.SpringBootTest;
6 | import org.springframework.test.context.junit4.SpringRunner;
7 |
8 | @RunWith(SpringRunner.class)
9 | @SpringBootTest
10 | public class SimpleRestApiApplicationTests {
11 |
12 | @Test
13 | public void contextLoads() {
14 | }
15 |
16 | }
17 |
--------------------------------------------------------------------------------
/rest-learncamel-spring-boot-with-mockito/src/main/java/com/learncamel/config/ApplicationConfig.java:
--------------------------------------------------------------------------------
1 | package com.learncamel.config;
2 |
3 | import org.springframework.context.annotation.Bean;
4 | import org.springframework.context.annotation.Configuration;
5 | import org.springframework.web.client.RestTemplate;
6 |
7 | @Configuration
8 | public class ApplicationConfig {
9 |
10 | @Bean
11 | public RestTemplate restTemplate(){
12 | return new RestTemplate();
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/activemq-learncamel-spring-boot/src/main/java/com/learncamel/ActiveMQCamelApplication.java:
--------------------------------------------------------------------------------
1 | package com.learncamel;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
5 | import org.springframework.boot.autoconfigure.SpringBootApplication;
6 |
7 | @SpringBootApplication
8 | @EnableAutoConfiguration
9 | public class ActiveMQCamelApplication {
10 |
11 | public static void main(String[] args) {
12 | SpringApplication.run(ActiveMQCamelApplication.class, args);
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/learncamel-spring-boot/src/main/java/com/learncamel/processor/SuccessMessageProcessor.java:
--------------------------------------------------------------------------------
1 | package com.learncamel.processor;
2 |
3 | import lombok.extern.slf4j.Slf4j;
4 | import org.apache.camel.Exchange;
5 | import org.apache.camel.Processor;
6 | import org.springframework.stereotype.Component;
7 |
8 | /**
9 | * Created by Dilip on 1/18/18.
10 | */
11 | @Component
12 | @Slf4j
13 | public class SuccessMessageProcessor implements Processor {
14 | @Override
15 | public void process(Exchange exchange) throws Exception {
16 | exchange.getIn().setBody("Data Updated Successfully");
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/set-up/How-to-download:run-activemq.md:
--------------------------------------------------------------------------------
1 | ## Apache ActiveMQ
2 | Apache ActiveMQ is the most popular and powerful open source messaging server.
3 |
4 | Step 1: Download Active MQ.
5 |
6 | ```
7 | http://activemq.apache.org/activemq-5145-release.html
8 | ```
9 |
10 | Step 2: Navigate to the bin directory and run the following command.
11 |
12 | ```
13 | ./activemq console
14 | ```
15 |
16 | Step 3: Below link has the steps to run Active MQ in your machine.
17 |
18 | ```
19 | http://activemq.apache.org/getting-started.html#GettingStarted-StartingActiveMQStartingActiveMQ
20 | ```
21 |
22 | Step 4:
23 |
24 | Console URL:
25 |
26 | ```
27 | http://127.0.0.1:8161/admin/
28 | ```
29 |
--------------------------------------------------------------------------------
/activemq-learncamel-spring-boot/src/main/java/com/learncamel/config/ActiveMQConfig.java:
--------------------------------------------------------------------------------
1 | package com.learncamel.config;
2 |
3 | import org.apache.activemq.ActiveMQConnectionFactory;
4 | import org.apache.activemq.camel.component.ActiveMQComponent;
5 | import org.springframework.context.annotation.Bean;
6 | import org.springframework.context.annotation.Configuration;
7 | import javax.jms.ConnectionFactory;
8 |
9 | @Configuration
10 | public class ActiveMQConfig {
11 |
12 |
13 | @Bean(name = "activemq")
14 | public ActiveMQComponent createComponent(ConnectionFactory factory) {
15 | ActiveMQComponent activeMQComponent = new ActiveMQComponent();
16 | activeMQComponent.setConnectionFactory(factory);
17 | return activeMQComponent;
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/learncamel-spring-boot/src/main/java/com/learncamel/config/DBConfig.java:
--------------------------------------------------------------------------------
1 | package com.learncamel.config;
2 |
3 | import org.springframework.boot.autoconfigure.jdbc.DataSourceBuilder;
4 | import org.springframework.boot.context.properties.ConfigurationProperties;
5 | import org.springframework.context.annotation.Bean;
6 | import org.springframework.context.annotation.Configuration;
7 |
8 | import javax.sql.DataSource;
9 |
10 | /**
11 | * Created by Dilip on 1/17/18.
12 | */
13 | @Configuration
14 | public class DBConfig {
15 |
16 | @Bean(name = "dataSource")
17 | @ConfigurationProperties(prefix = "spring.datasource")
18 | public DataSource dataSource() {
19 | DataSource ds = DataSourceBuilder.create().build();
20 | return ds;
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/activemq-learncamel-spring-boot/src/main/java/com/learncamel/config/DBConfig.java:
--------------------------------------------------------------------------------
1 | package com.learncamel.config;
2 |
3 | import org.springframework.boot.autoconfigure.jdbc.DataSourceBuilder;
4 | import org.springframework.boot.context.properties.ConfigurationProperties;
5 | import org.springframework.context.annotation.Bean;
6 | import org.springframework.context.annotation.Configuration;
7 |
8 | import javax.sql.DataSource;
9 |
10 | /**
11 | * Created by Dilip on 1/17/18.
12 | */
13 | @Configuration
14 | public class DBConfig {
15 |
16 | @Bean(name = "dataSource")
17 | @ConfigurationProperties(prefix = "spring.datasource")
18 | public DataSource dataSource() {
19 | DataSource ds = DataSourceBuilder.create().build();
20 | return ds;
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/camel-spring-boot-boiler-plate/src/main/java/com/learncamel/config/DBConfig.java:
--------------------------------------------------------------------------------
1 | package com.learncamel.config;
2 |
3 | import org.springframework.boot.autoconfigure.jdbc.DataSourceBuilder;
4 | import org.springframework.boot.context.properties.ConfigurationProperties;
5 | import org.springframework.context.annotation.Bean;
6 | import org.springframework.context.annotation.Configuration;
7 |
8 | import javax.sql.DataSource;
9 |
10 | /**
11 | * Created by Dilip on 1/17/18.
12 | */
13 | @Configuration
14 | public class DBConfig {
15 |
16 | @Bean(name = "dataSource")
17 | @ConfigurationProperties(prefix = "spring.datasource")
18 | public DataSource dataSource() {
19 | DataSource ds = DataSourceBuilder.create().build();
20 | return ds;
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/kafka-learncamel-spring-boot/src/main/java/com/learncamel/config/DBConfig.java:
--------------------------------------------------------------------------------
1 | package com.learncamel.config;
2 |
3 | import org.springframework.boot.autoconfigure.jdbc.DataSourceBuilder;
4 | import org.springframework.boot.context.properties.ConfigurationProperties;
5 | import org.springframework.context.annotation.Bean;
6 | import org.springframework.context.annotation.Configuration;
7 |
8 | import javax.sql.DataSource;
9 |
10 | /**
11 | * Created by Dilip on 1/17/18.
12 | */
13 | @Configuration
14 | public class DBConfig {
15 |
16 | @Bean(name = "dataSource")
17 | @ConfigurationProperties(prefix = "spring.datasource")
18 | public DataSource dataSource() {
19 | DataSource ds = DataSourceBuilder.create().build();
20 | return ds;
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/rest-learncamel-spring-boot/src/main/java/com/learncamel/config/DBConfig.java:
--------------------------------------------------------------------------------
1 | package com.learncamel.config;
2 |
3 | import org.springframework.boot.autoconfigure.jdbc.DataSourceBuilder;
4 | import org.springframework.boot.context.properties.ConfigurationProperties;
5 | import org.springframework.context.annotation.Bean;
6 | import org.springframework.context.annotation.Configuration;
7 |
8 | import javax.sql.DataSource;
9 |
10 | /**
11 | * Created by Dilip on 1/17/18.
12 | */
13 | @Configuration
14 | public class DBConfig {
15 |
16 | @Bean(name = "dataSource")
17 | @ConfigurationProperties(prefix = "spring.datasource")
18 | public DataSource dataSource() {
19 | DataSource ds = DataSourceBuilder.create().build();
20 | return ds;
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/soap-springws-learncamel-spring-boot/src/main/java/com/learncamel/config/DBConfig.java:
--------------------------------------------------------------------------------
1 | package com.learncamel.config;
2 |
3 | import org.springframework.boot.autoconfigure.jdbc.DataSourceBuilder;
4 | import org.springframework.boot.context.properties.ConfigurationProperties;
5 | import org.springframework.context.annotation.Bean;
6 | import org.springframework.context.annotation.Configuration;
7 |
8 | import javax.sql.DataSource;
9 |
10 | /**
11 | * Created by Dilip on 1/17/18.
12 | */
13 | @Configuration
14 | public class DBConfig {
15 |
16 | @Bean(name = "dataSource")
17 | @ConfigurationProperties(prefix = "spring.datasource")
18 | public DataSource dataSource() {
19 | DataSource ds = DataSourceBuilder.create().build();
20 | return ds;
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/rest-learncamel-spring-boot-with-mockito/src/main/java/com/learncamel/config/DBConfig.java:
--------------------------------------------------------------------------------
1 | package com.learncamel.config;
2 |
3 | import org.springframework.boot.autoconfigure.jdbc.DataSourceBuilder;
4 | import org.springframework.boot.context.properties.ConfigurationProperties;
5 | import org.springframework.context.annotation.Bean;
6 | import org.springframework.context.annotation.Configuration;
7 |
8 | import javax.sql.DataSource;
9 |
10 | /**
11 | * Created by Dilip on 1/17/18.
12 | */
13 | @Configuration
14 | public class DBConfig {
15 |
16 | @Bean(name = "dataSource")
17 | @ConfigurationProperties(prefix = "spring.datasource")
18 | public DataSource dataSource() {
19 | DataSource ds = DataSourceBuilder.create().build();
20 | return ds;
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/soap-springws-learncamel-spring-boot/src/main/java/com/learncamel/domain/Country.java:
--------------------------------------------------------------------------------
1 | package com.learncamel.domain;
2 |
3 | public class Country {
4 |
5 | protected String sISOCode;
6 | protected String sName;
7 |
8 | public String getsISOCode() {
9 | return sISOCode;
10 | }
11 |
12 | public void setsISOCode(String sISOCode) {
13 | this.sISOCode = sISOCode;
14 | }
15 |
16 | public String getsName() {
17 | return sName;
18 | }
19 |
20 | public void setsName(String sName) {
21 | this.sName = sName;
22 | }
23 |
24 | @Override
25 | public String toString() {
26 | return "Country{" +
27 | "sISOCode='" + sISOCode + '\'' +
28 | ", sName='" + sName + '\'' +
29 | '}';
30 | }
31 | }
32 |
33 |
34 |
--------------------------------------------------------------------------------
/soap-springws-learncamel-spring-boot/src/main/java/com/learncamel/config/SoapConfig.java:
--------------------------------------------------------------------------------
1 | package com.learncamel.config;
2 |
3 | import org.springframework.context.annotation.Bean;
4 | import org.springframework.context.annotation.Configuration;
5 | import org.springframework.ws.client.core.WebServiceTemplate;
6 |
7 | @Configuration
8 | public class SoapConfig {
9 |
10 | @Bean(value = "webServiceTemplate")
11 | public WebServiceTemplate createWebServiceTemplate(){
12 | WebServiceTemplate template = new WebServiceTemplate();
13 | template.setDefaultUri("http://www.oorsprong.org/websamples.countryinfo/CountryInfoService.wso");
14 | return template;
15 | }
16 |
17 | /* @Bean(value = "cdataTransformer")
18 | public CDataTransformer cDataTransformer(){
19 | return new CDataTransformer();
20 | }*/
21 | }
22 |
--------------------------------------------------------------------------------
/kafka-learncamel-spring-boot/src/main/java/com/learncamel/processor/ValidateDataProcessor.java:
--------------------------------------------------------------------------------
1 | package com.learncamel.processor;
2 |
3 | import com.learncamel.domain.Item;
4 | import com.learncamel.exception.DataException;
5 | import lombok.extern.slf4j.Slf4j;
6 | import org.apache.camel.Exchange;
7 | import org.apache.camel.Processor;
8 | import org.springframework.stereotype.Component;
9 | import org.springframework.util.ObjectUtils;
10 |
11 | @Component
12 | @Slf4j
13 | public class ValidateDataProcessor implements Processor {
14 | @Override
15 | public void process(Exchange exchange) throws Exception {
16 |
17 | Item item = (Item) exchange.getIn().getBody();
18 | log.info(" Item in ValidateDataProcessor is : " + item);
19 |
20 | if(ObjectUtils.isEmpty(item.getSku())){
21 | throw new DataException("Sku is null for " + item.getItemDescription());
22 | }
23 |
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/simple-rest-api/src/main/java/com/learnspringboot/controller/CurrentTimeController.java:
--------------------------------------------------------------------------------
1 | package com.learnspringboot.controller;
2 |
3 | import com.learnspringboot.service.CurrentTimeService;
4 | import org.springframework.beans.factory.annotation.Autowired;
5 | import org.springframework.web.bind.annotation.RequestMapping;
6 | import org.springframework.web.bind.annotation.RestController;
7 |
8 | import java.time.LocalDateTime;
9 |
10 | /**
11 | * Created by Dilip on 1/7/18.
12 | */
13 | @RestController
14 | public class CurrentTimeController {
15 |
16 | @Autowired
17 | CurrentTimeService currentTimeService;
18 |
19 | @RequestMapping(value = "/currentTime")
20 | public String getCurrentDateTime() throws InterruptedException {
21 | System.out.println("controller getCurrentDateTime call"+ LocalDateTime.now().toString());
22 | return currentTimeService.getCurrentDateTime();
23 |
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/activemq-learncamel-spring-boot/src/main/java/com/learncamel/processor/ValidateDataProcessor.java:
--------------------------------------------------------------------------------
1 | package com.learncamel.processor;
2 |
3 | import com.learncamel.domain.Item;
4 | import com.learncamel.exception.DataException;
5 | import lombok.extern.slf4j.Slf4j;
6 | import org.apache.camel.Exchange;
7 | import org.apache.camel.Processor;
8 | import org.springframework.stereotype.Component;
9 | import org.springframework.util.ObjectUtils;
10 |
11 | @Component
12 | @Slf4j
13 | public class ValidateDataProcessor implements Processor {
14 | @Override
15 | public void process(Exchange exchange) throws Exception {
16 |
17 | Item item = (Item) exchange.getIn().getBody();
18 | log.info(" Item in ValidateDataProcessor is : " + item);
19 |
20 | if(ObjectUtils.isEmpty(item.getSku())){
21 | throw new DataException("Sku is null for " + item.getItemDescription());
22 | }
23 |
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/soap-springws-learncamel-spring-boot/src/main/java/net/webservicex/GetCountries.java:
--------------------------------------------------------------------------------
1 |
2 | package net.webservicex;
3 |
4 | import javax.xml.bind.annotation.XmlAccessType;
5 | import javax.xml.bind.annotation.XmlAccessorType;
6 | import javax.xml.bind.annotation.XmlRootElement;
7 | import javax.xml.bind.annotation.XmlType;
8 |
9 |
10 | /**
11 | *
Java class for anonymous complex type.
12 | *
13 | *
The following schema fragment specifies the expected content contained within this class.
14 | *
15 | *
16 | * <complexType>
17 | * <complexContent>
18 | * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
19 | * </restriction>
20 | * </complexContent>
21 | * </complexType>
22 | *
23 | *
24 | *
25 | */
26 | @XmlAccessorType(XmlAccessType.FIELD)
27 | @XmlType(name = "")
28 | @XmlRootElement(name = "GetCountries")
29 | public class GetCountries {
30 |
31 |
32 | }
33 |
--------------------------------------------------------------------------------
/soap-springws-learncamel-spring-boot/src/main/java/net/webservicex/GetCurrencies.java:
--------------------------------------------------------------------------------
1 |
2 | package net.webservicex;
3 |
4 | import javax.xml.bind.annotation.XmlAccessType;
5 | import javax.xml.bind.annotation.XmlAccessorType;
6 | import javax.xml.bind.annotation.XmlRootElement;
7 | import javax.xml.bind.annotation.XmlType;
8 |
9 |
10 | /**
11 | * Java class for anonymous complex type.
12 | *
13 | *
The following schema fragment specifies the expected content contained within this class.
14 | *
15 | *
16 | * <complexType>
17 | * <complexContent>
18 | * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
19 | * </restriction>
20 | * </complexContent>
21 | * </complexType>
22 | *
23 | *
24 | *
25 | */
26 | @XmlAccessorType(XmlAccessType.FIELD)
27 | @XmlType(name = "")
28 | @XmlRootElement(name = "GetCurrencies")
29 | public class GetCurrencies {
30 |
31 |
32 | }
33 |
--------------------------------------------------------------------------------
/rest-learncamel-spring-boot/src/main/java/com/learncamel/processor/CountrySelectProcessor.java:
--------------------------------------------------------------------------------
1 | package com.learncamel.processor;
2 |
3 | import lombok.extern.slf4j.Slf4j;
4 | import org.apache.camel.Exchange;
5 | import org.apache.camel.Processor;
6 | import org.springframework.stereotype.Component;
7 |
8 | import java.util.Arrays;
9 | import java.util.List;
10 | import java.util.Random;
11 |
12 | @Component
13 | @Slf4j
14 | public class CountrySelectProcessor implements Processor {
15 |
16 |
17 | List countryList = Arrays.asList("us","in", "gb","cn","jp");
18 |
19 | @Override
20 | public void process(Exchange exchange) throws Exception {
21 | Random random = new Random();
22 | String countryCode = countryList.get(random.nextInt(countryList.size()-1));
23 |
24 | log.info("Selected Country Code is : " + countryCode);
25 |
26 | exchange.getIn().setHeader("countryId", countryCode);
27 |
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/soap-springws-learncamel-spring-boot/src/main/java/net/webservicex/GetCurrencyCode.java:
--------------------------------------------------------------------------------
1 |
2 | package net.webservicex;
3 |
4 | import javax.xml.bind.annotation.XmlAccessType;
5 | import javax.xml.bind.annotation.XmlAccessorType;
6 | import javax.xml.bind.annotation.XmlRootElement;
7 | import javax.xml.bind.annotation.XmlType;
8 |
9 |
10 | /**
11 | * Java class for anonymous complex type.
12 | *
13 | *
The following schema fragment specifies the expected content contained within this class.
14 | *
15 | *
16 | * <complexType>
17 | * <complexContent>
18 | * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
19 | * </restriction>
20 | * </complexContent>
21 | * </complexType>
22 | *
23 | *
24 | *
25 | */
26 | @XmlAccessorType(XmlAccessType.FIELD)
27 | @XmlType(name = "")
28 | @XmlRootElement(name = "GetCurrencyCode")
29 | public class GetCurrencyCode {
30 |
31 |
32 | }
33 |
--------------------------------------------------------------------------------
/rest-learncamel-spring-boot-with-mockito/src/main/java/com/learncamel/processor/CountrySelectProcessor.java:
--------------------------------------------------------------------------------
1 | package com.learncamel.processor;
2 |
3 | import lombok.extern.slf4j.Slf4j;
4 | import org.apache.camel.Exchange;
5 | import org.apache.camel.Processor;
6 | import org.springframework.stereotype.Component;
7 |
8 | import java.util.Arrays;
9 | import java.util.List;
10 | import java.util.Random;
11 |
12 | @Component
13 | @Slf4j
14 | public class CountrySelectProcessor implements Processor {
15 |
16 |
17 | List countryList = Arrays.asList("us","in", "gb","cn","jp");
18 |
19 | @Override
20 | public void process(Exchange exchange) throws Exception {
21 | Random random = new Random();
22 | String countryCode = countryList.get(random.nextInt(countryList.size()-1));
23 |
24 | log.info("Selected Country Code is : " + countryCode);
25 |
26 | exchange.getIn().setHeader("countryId", countryCode);
27 |
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/rest-learncamel-spring-boot-with-mockito/src/main/java/com/learncamel/service/CountryService.java:
--------------------------------------------------------------------------------
1 | package com.learncamel.service;
2 |
3 | import org.springframework.beans.factory.annotation.Autowired;
4 | import org.springframework.http.ResponseEntity;
5 | import org.springframework.stereotype.Component;
6 | import org.springframework.web.client.RestTemplate;
7 |
8 | import java.time.LocalDateTime;
9 |
10 | @Component
11 | public class CountryService {
12 |
13 |
14 | @Autowired
15 | RestTemplate restTemplate;
16 |
17 | public String getCurrentDateTime(){
18 |
19 | LocalDateTime localDateTime = LocalDateTime.now();
20 | return localDateTime.toString();
21 | }
22 |
23 |
24 | public String getCountryDetails(String countryCode){
25 |
26 | String url = "https://restcountries.eu/rest/v2/alpha/".concat(countryCode);
27 |
28 | ResponseEntity response = restTemplate.getForEntity(url, String.class);
29 |
30 | return response.getBody();
31 | }
32 |
33 |
34 |
35 | }
36 |
--------------------------------------------------------------------------------
/soap-springws-learncamel-spring-boot/src/main/java/com/learncamel/processor/BuildSQLProcessor.java:
--------------------------------------------------------------------------------
1 | package com.learncamel.processor;
2 |
3 | import com.learncamel.domain.Country;
4 | import lombok.extern.slf4j.Slf4j;
5 | import org.apache.camel.Exchange;
6 | import org.apache.camel.Processor;
7 | import org.springframework.stereotype.Component;
8 |
9 | @Component
10 | @Slf4j
11 | public class BuildSQLProcessor implements Processor {
12 |
13 | @Override
14 | public void process(Exchange exchange) throws Exception {
15 |
16 | Country country = (Country) exchange.getIn().getBody();
17 |
18 | StringBuilder query = new StringBuilder();
19 |
20 | query.append("INSERT INTO COUNTRIES (NAME, COUNTRY_CODE) VALUES ('");
21 | query.append(country.getsName()+"','"+country.getsISOCode()+"');");
22 | log.info("Final Query is : " + query);
23 | exchange.getIn().setBody(query.toString());
24 | exchange.getIn().setHeader("countryCode",country.getsISOCode());
25 |
26 | }
27 |
28 |
29 | }
30 |
--------------------------------------------------------------------------------
/set-up/How-to-install-Postgres-in-Windows.md:
--------------------------------------------------------------------------------
1 | # PostGresSql
2 |
3 | ## How to install PostGres?
4 |
5 | Download postgres from the below link.
6 |
7 | ```
8 | https://www.enterprisedb.com/downloads/postgres-postgresql-downloads#windows
9 | ```
10 |
11 | ## Postgres GUI client
12 |
13 | The installer will provide you the **pgAdmin** client as part of the installation.
14 |
15 | We can use this client to connect to the database.
16 |
17 | ## How to connect to Postgres from Intellij:
18 |
19 | Step 1:
20 |
21 | **Mac :**
22 |
23 | ```
24 | Intellij IDEA -> Preferences -> Plugins
25 | ```
26 |
27 | **Windows:**
28 |
29 | ```
30 | File -> Settings-> Plugins
31 | ```
32 |
33 | Below steps are the same for windows and Mac.
34 | Step 2:
35 |
36 | Search for **DataBase Navigator**.
37 |
38 | Step 3:
39 |
40 | Install the plugin and restart the Intellij.
41 |
42 | Step 4:
43 |
44 | There will be a **Database Navigator** in the Menu bar.
45 |
46 | Step 5:
47 |
48 | Click on **DataBase Navigator**.
49 |
50 | Click on **Open SQL Console**.
51 |
--------------------------------------------------------------------------------
/rest-learncamel-spring-boot/src/main/java/com/learncamel/domain/Country.java:
--------------------------------------------------------------------------------
1 | package com.learncamel.domain;
2 |
3 | public class Country {
4 |
5 | String name;
6 | String alpha3Code;
7 | String population;
8 |
9 | public String getName() {
10 | return name;
11 | }
12 |
13 | public void setName(String name) {
14 | this.name = name;
15 | }
16 |
17 | public String getAlpha3Code() {
18 | return alpha3Code;
19 | }
20 |
21 | public void setAlpha3Code(String alpha3Code) {
22 | this.alpha3Code = alpha3Code;
23 | }
24 |
25 | public String getPopulation() {
26 | return population;
27 | }
28 |
29 | public void setPopulation(String population) {
30 | this.population = population;
31 | }
32 |
33 | @Override
34 | public String toString() {
35 | return "Country{" +
36 | "name='" + name + '\'' +
37 | ", alpha3Code='" + alpha3Code + '\'' +
38 | ", population='" + population + '\'' +
39 | '}';
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/rest-learncamel-spring-boot-with-mockito/src/main/java/com/learncamel/domain/Country.java:
--------------------------------------------------------------------------------
1 | package com.learncamel.domain;
2 |
3 | public class Country {
4 |
5 | String name;
6 | String alpha3Code;
7 | String population;
8 |
9 | public String getName() {
10 | return name;
11 | }
12 |
13 | public void setName(String name) {
14 | this.name = name;
15 | }
16 |
17 | public String getAlpha3Code() {
18 | return alpha3Code;
19 | }
20 |
21 | public void setAlpha3Code(String alpha3Code) {
22 | this.alpha3Code = alpha3Code;
23 | }
24 |
25 | public String getPopulation() {
26 | return population;
27 | }
28 |
29 | public void setPopulation(String population) {
30 | this.population = population;
31 | }
32 |
33 | @Override
34 | public String toString() {
35 | return "Country{" +
36 | "name='" + name + '\'' +
37 | ", alpha3Code='" + alpha3Code + '\'' +
38 | ", population='" + population + '\'' +
39 | '}';
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/rest-learncamel-spring-boot/src/main/java/com/learncamel/processor/BuildSQLProcessor.java:
--------------------------------------------------------------------------------
1 | package com.learncamel.processor;
2 |
3 | import com.learncamel.domain.Country;
4 | import lombok.extern.slf4j.Slf4j;
5 | import org.apache.camel.Exchange;
6 | import org.apache.camel.Processor;
7 | import org.springframework.stereotype.Component;
8 |
9 | import java.util.Arrays;
10 | import java.util.List;
11 | import java.util.Random;
12 |
13 | @Component
14 | @Slf4j
15 | public class BuildSQLProcessor implements Processor {
16 |
17 | @Override
18 | public void process(Exchange exchange) throws Exception {
19 |
20 | Country country = (Country) exchange.getIn().getBody();
21 |
22 | StringBuilder query = new StringBuilder();
23 |
24 | query.append("INSERT INTO COUNTRY (NAME, COUNTRY_CODE,POPULATION) VALUES ('");
25 | query.append(country.getName()+"','"+country.getAlpha3Code()+"',"+country.getPopulation()+");");
26 | log.info("Final Query is : " + query);
27 | exchange.getIn().setBody(query.toString());
28 | exchange.getIn().setHeader("countryCode" , country.getAlpha3Code());
29 |
30 | }
31 |
32 |
33 | }
34 |
--------------------------------------------------------------------------------
/rest-learncamel-spring-boot-with-mockito/src/main/java/com/learncamel/processor/BuildSQLProcessor.java:
--------------------------------------------------------------------------------
1 | package com.learncamel.processor;
2 |
3 | import com.learncamel.domain.Country;
4 | import lombok.extern.slf4j.Slf4j;
5 | import org.apache.camel.Exchange;
6 | import org.apache.camel.Processor;
7 | import org.springframework.stereotype.Component;
8 |
9 | import java.util.Arrays;
10 | import java.util.List;
11 | import java.util.Random;
12 |
13 | @Component
14 | @Slf4j
15 | public class BuildSQLProcessor implements Processor {
16 |
17 | @Override
18 | public void process(Exchange exchange) throws Exception {
19 |
20 | Country country = (Country) exchange.getIn().getBody();
21 |
22 | StringBuilder query = new StringBuilder();
23 |
24 | query.append("INSERT INTO COUNTRY (NAME, COUNTRY_CODE,POPULATION) VALUES ('");
25 | query.append(country.getName()+"','"+country.getAlpha3Code()+"',"+country.getPopulation()+");");
26 | log.info("Final Query is : " + query);
27 | exchange.getIn().setBody(query.toString());
28 | exchange.getIn().setHeader("countryCode" , country.getAlpha3Code());
29 |
30 | }
31 |
32 |
33 | }
34 |
--------------------------------------------------------------------------------
/rest-learncamel-spring-boot-with-mockito/src/test/java/com/learncamel/routes/service/CountryServiceTest.java:
--------------------------------------------------------------------------------
1 | package com.learncamel.routes.service;
2 |
3 | import com.learncamel.service.CountryService;
4 | import org.apache.camel.test.spring.CamelSpringBootRunner;
5 | import org.junit.Test;
6 | import org.junit.runner.RunWith;
7 | import org.springframework.beans.factory.annotation.Autowired;
8 | import org.springframework.boot.test.context.SpringBootTest;
9 | import org.springframework.test.annotation.DirtiesContext;
10 | import org.springframework.test.context.ActiveProfiles;
11 |
12 | import static org.junit.Assert.assertNotNull;
13 | import static org.junit.Assert.assertTrue;
14 |
15 | @ActiveProfiles("dev")
16 | @RunWith(CamelSpringBootRunner.class)
17 | @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
18 | @DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_EACH_TEST_METHOD)
19 | public class CountryServiceTest {
20 |
21 | @Autowired
22 | CountryService countryService;
23 |
24 | @Test
25 | public void getCountryDetails(){
26 | String responseBody = countryService.getCountryDetails("us");
27 | System.out.println("responseBody : " + responseBody);
28 | assertNotNull(responseBody);
29 | assertTrue(responseBody.contains("United States of America"));
30 | }
31 |
32 | }
33 |
--------------------------------------------------------------------------------
/simple-rest-api/src/main/java/com/learnspringboot/service/CurrentTimeService.java:
--------------------------------------------------------------------------------
1 | package com.learnspringboot.service;
2 |
3 | import org.apache.tomcat.jni.Local;
4 | import org.springframework.beans.factory.annotation.Autowired;
5 | import org.springframework.core.env.Environment;
6 | import org.springframework.scheduling.annotation.Async;
7 | import org.springframework.stereotype.Service;
8 |
9 | import java.time.LocalDateTime;
10 |
11 | /**
12 | * Created by Dilip on 1/7/18.
13 | */
14 | @Service
15 | public class CurrentTimeService {
16 |
17 | @Autowired
18 | Environment environment;
19 |
20 | public String getCurrentDateTime() throws InterruptedException {
21 |
22 | LocalDateTime localDateTime = getCurrentTime();
23 | System.out.println("Inside getCurrentDateTime" + LocalDateTime.now().toString());
24 | String response = environment.getProperty("message").concat("\n").concat(localDateTime.toString());
25 | System.out.println("after getCurrentDateTime call"+ LocalDateTime.now().toString());
26 | return response;
27 | }
28 |
29 | @Async
30 | public LocalDateTime getCurrentTime() throws InterruptedException {
31 | System.out.println("Inside getCurrentTime"+ LocalDateTime.now().toString());
32 | Thread.sleep(5000);
33 | return LocalDateTime.now();
34 |
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/learncamel-spring-boot/src/main/resources/logback.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 | %d{dd-MM-yyyy HH:mm:ss.SSS} %green([%thread]) %highlight(%-5level) %logger{36}.%M - %msg%n
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 | ${LOG_PATH}/camellog.log
19 |
20 |
21 |
22 | %d{dd-MM-yyyy HH:mm:ss.SSS} [%thread] %-5level %logger{36}.%M - %msg%n
23 |
24 |
25 |
26 |
27 |
28 | ${LOG_PATH}/archived/log_%d{dd-MM-yyyy}.log
29 |
30 | 10
31 | 100MB
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/kafka-learncamel-spring-boot/src/main/resources/logback.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 | %d{dd-MM-yyyy HH:mm:ss.SSS} %green([%thread]) %highlight(%-5level) %logger{36}.%M - %msg%n
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 | ${LOG_PATH}/camellog.log
19 |
20 |
21 |
22 | %d{dd-MM-yyyy HH:mm:ss.SSS} [%thread] %-5level %logger{36}.%M - %msg%n
23 |
24 |
25 |
26 |
27 |
28 | ${LOG_PATH}/archived/log_%d{dd-MM-yyyy}.log
29 |
30 | 10
31 | 100MB
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/rest-learncamel-spring-boot/src/main/resources/logback.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 | %d{dd-MM-yyyy HH:mm:ss.SSS} %green([%thread]) %highlight(%-5level) %logger{36}.%M - %msg%n
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 | ${LOG_PATH}/camellog.log
19 |
20 |
21 |
22 | %d{dd-MM-yyyy HH:mm:ss.SSS} [%thread] %-5level %logger{36}.%M - %msg%n
23 |
24 |
25 |
26 |
27 |
28 | ${LOG_PATH}/archived/log_%d{dd-MM-yyyy}.log
29 |
30 | 10
31 | 100MB
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/activemq-learncamel-spring-boot/src/main/resources/logback.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 | %d{dd-MM-yyyy HH:mm:ss.SSS} %green([%thread]) %highlight(%-5level) %logger{36}.%M - %msg%n
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 | ${LOG_PATH}/camellog.log
19 |
20 |
21 |
22 | %d{dd-MM-yyyy HH:mm:ss.SSS} [%thread] %-5level %logger{36}.%M - %msg%n
23 |
24 |
25 |
26 |
27 |
28 | ${LOG_PATH}/archived/log_%d{dd-MM-yyyy}.log
29 |
30 | 10
31 | 100MB
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/camel-spring-boot-boiler-plate/src/main/resources/logback.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 | %d{dd-MM-yyyy HH:mm:ss.SSS} %green([%thread]) %highlight(%-5level) %logger{36}.%M - %msg%n
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 | ${LOG_PATH}/camellog.log
19 |
20 |
21 |
22 | %d{dd-MM-yyyy HH:mm:ss.SSS} [%thread] %-5level %logger{36}.%M - %msg%n
23 |
24 |
25 |
26 |
27 |
28 | ${LOG_PATH}/archived/log_%d{dd-MM-yyyy}.log
29 |
30 | 10
31 | 100MB
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/soap-springws-learncamel-spring-boot/src/main/resources/logback.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 | %d{dd-MM-yyyy HH:mm:ss.SSS} %green([%thread]) %highlight(%-5level) %logger{36}.%M - %msg%n
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 | ${LOG_PATH}/camellog.log
19 |
20 |
21 |
22 | %d{dd-MM-yyyy HH:mm:ss.SSS} [%thread] %-5level %logger{36}.%M - %msg%n
23 |
24 |
25 |
26 |
27 |
28 | ${LOG_PATH}/archived/log_%d{dd-MM-yyyy}.log
29 |
30 | 10
31 | 100MB
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/rest-learncamel-spring-boot-with-mockito/src/main/resources/logback.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 | %d{dd-MM-yyyy HH:mm:ss.SSS} %green([%thread]) %highlight(%-5level) %logger{36}.%M - %msg%n
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 | ${LOG_PATH}/camellog.log
19 |
20 |
21 |
22 | %d{dd-MM-yyyy HH:mm:ss.SSS} [%thread] %-5level %logger{36}.%M - %msg%n
23 |
24 |
25 |
26 |
27 |
28 | ${LOG_PATH}/archived/log_%d{dd-MM-yyyy}.log
29 |
30 | 10
31 | 100MB
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/rest-learncamel-spring-boot/src/main/java/com/learncamel/routes/HealthCheckRoute.java:
--------------------------------------------------------------------------------
1 | package com.learncamel.routes;
2 |
3 | import com.learncamel.alert.MailProcessor;
4 | import com.learncamel.processor.HealthCheckProcessor;
5 | import org.apache.camel.Predicate;
6 | import org.apache.camel.builder.RouteBuilder;
7 | import org.springframework.beans.factory.annotation.Autowired;
8 | import org.springframework.stereotype.Component;
9 |
10 | /**
11 | * Created by Dilip on 2/10/18.
12 | */
13 | @Component
14 | public class HealthCheckRoute extends RouteBuilder{
15 |
16 |
17 | @Autowired
18 | HealthCheckProcessor healthCheckProcessor;
19 |
20 | @Autowired
21 | MailProcessor mailProcessor;
22 |
23 | Predicate isNotDev = header("env").isNotEqualTo("mock");
24 |
25 |
26 | @Override
27 | public void configure() throws Exception {
28 |
29 | from("{{healthRoute}}").routeId("healthRoute")
30 | .choice() // Content based EIP
31 | .when(isNotDev) // not dev check
32 | .pollEnrich("http://localhost:8080/health")
33 | .end()
34 | .process(healthCheckProcessor)
35 | .choice()
36 | .when(header("error").isEqualTo(true))
37 | .choice()
38 | .when(isNotDev)
39 | .process(mailProcessor)
40 | .end()
41 | .end();
42 |
43 |
44 |
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/activemq-learncamel-spring-boot/src/main/java/com/learncamel/routes/HealthCheckRoute.java:
--------------------------------------------------------------------------------
1 | package com.learncamel.routes;
2 |
3 | import com.learncamel.alert.MailProcessor;
4 | import com.learncamel.processor.HealthCheckProcessor;
5 | import org.apache.camel.Predicate;
6 | import org.apache.camel.builder.RouteBuilder;
7 | import org.springframework.beans.factory.annotation.Autowired;
8 | import org.springframework.stereotype.Component;
9 |
10 | /**
11 | * Created by Dilip on 2/10/18.
12 | */
13 | @Component
14 | public class HealthCheckRoute extends RouteBuilder{
15 |
16 |
17 | @Autowired
18 | HealthCheckProcessor healthCheckProcessor;
19 |
20 | @Autowired
21 | MailProcessor mailProcessor;
22 |
23 | Predicate isNotDev = header("env").isNotEqualTo("mock");
24 |
25 |
26 | @Override
27 | public void configure() throws Exception {
28 |
29 | from("{{healthRoute}}").routeId("healthRoute")
30 | .choice() // Content based EIP
31 | .when(isNotDev) // not dev check
32 | .pollEnrich("http://localhost:8080/health")
33 | .end()
34 | .process(healthCheckProcessor)
35 | .choice()
36 | .when(header("error").isEqualTo(true))
37 | .choice()
38 | .when(isNotDev)
39 | .process(mailProcessor)
40 | .end()
41 | .end();
42 |
43 |
44 |
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/camel-spring-boot-boiler-plate/src/main/java/com/learncamel/routes/HealthCheckRoute.java:
--------------------------------------------------------------------------------
1 | package com.learncamel.routes;
2 |
3 | import com.learncamel.alert.MailProcessor;
4 | import com.learncamel.processor.HealthCheckProcessor;
5 | import org.apache.camel.Predicate;
6 | import org.apache.camel.builder.RouteBuilder;
7 | import org.springframework.beans.factory.annotation.Autowired;
8 | import org.springframework.stereotype.Component;
9 |
10 | /**
11 | * Created by Dilip on 2/10/18.
12 | */
13 | @Component
14 | public class HealthCheckRoute extends RouteBuilder{
15 |
16 |
17 | @Autowired
18 | HealthCheckProcessor healthCheckProcessor;
19 |
20 | @Autowired
21 | MailProcessor mailProcessor;
22 |
23 | Predicate isNotDev = header("env").isNotEqualTo("mock");
24 |
25 |
26 | @Override
27 | public void configure() throws Exception {
28 |
29 | from("{{healthRoute}}").routeId("healthRoute")
30 | .choice() // Content based EIP
31 | .when(isNotDev) // not dev check
32 | .pollEnrich("http://localhost:8080/health")
33 | .end()
34 | .process(healthCheckProcessor)
35 | .choice()
36 | .when(header("error").isEqualTo(true))
37 | .choice()
38 | .when(isNotDev)
39 | .process(mailProcessor)
40 | .end()
41 | .end();
42 |
43 |
44 |
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/kafka-learncamel-spring-boot/src/main/java/com/learncamel/routes/HealthCheckRoute.java:
--------------------------------------------------------------------------------
1 | package com.learncamel.routes;
2 |
3 | import com.learncamel.alert.MailProcessor;
4 | import com.learncamel.processor.HealthCheckProcessor;
5 | import org.apache.camel.Predicate;
6 | import org.apache.camel.builder.RouteBuilder;
7 | import org.springframework.beans.factory.annotation.Autowired;
8 | import org.springframework.stereotype.Component;
9 |
10 | /**
11 | * Created by Dilip on 2/10/18.
12 | */
13 | @Component
14 | public class HealthCheckRoute extends RouteBuilder{
15 |
16 |
17 | @Autowired
18 | HealthCheckProcessor healthCheckProcessor;
19 |
20 | @Autowired
21 | MailProcessor mailProcessor;
22 |
23 | Predicate isNotDev = header("env").isNotEqualTo("mock");
24 |
25 |
26 | @Override
27 | public void configure() throws Exception {
28 |
29 | from("{{healthRoute}}").routeId("healthRoute")
30 | .choice() // Content based EIP
31 | .when(isNotDev) // not dev check
32 | .pollEnrich("http://localhost:8080/health")
33 | .end()
34 | .process(healthCheckProcessor)
35 | .choice()
36 | .when(header("error").isEqualTo(true))
37 | .choice()
38 | .when(isNotDev)
39 | .process(mailProcessor)
40 | .end()
41 | .end();
42 |
43 |
44 |
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/learncamel-spring-boot/src/main/java/com/learncamel/alert/MailProcessor.java:
--------------------------------------------------------------------------------
1 | package com.learncamel.alert;
2 |
3 |
4 | import lombok.extern.slf4j.Slf4j;
5 | import org.apache.camel.Exchange;
6 | import org.apache.camel.Processor;
7 | import org.springframework.beans.factory.annotation.Autowired;
8 | import org.springframework.core.env.Environment;
9 | import org.springframework.mail.SimpleMailMessage;
10 | import org.springframework.mail.javamail.JavaMailSender;
11 | import org.springframework.stereotype.Component;
12 |
13 | /**
14 | * Created by Dilip on 1/20/18.
15 | */
16 | @Component
17 | @Slf4j
18 | public class MailProcessor implements Processor {
19 |
20 | @Autowired
21 | public JavaMailSender emailSender;
22 |
23 | @Autowired
24 | Environment environment;
25 |
26 | @Override
27 | public void process(Exchange exchange) throws Exception {
28 |
29 | Exception e = exchange.getProperty(Exchange.EXCEPTION_CAUGHT, Exception.class);
30 | log.info("Error Message in MailProcessor : " + e.getMessage());
31 |
32 | String messageBody = "Exception happened in the route and the exception is " + e.getMessage();
33 |
34 | SimpleMailMessage message = new SimpleMailMessage();
35 | message.setFrom(environment.getProperty("mailFrom"));
36 | message.setTo(environment.getProperty("mailto"));
37 | message.setSubject("Exception in Camel Route");
38 | message.setText(messageBody);
39 |
40 | emailSender.send(message);
41 |
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/activemq-learncamel-spring-boot/src/main/java/com/learncamel/alert/MailProcessor.java:
--------------------------------------------------------------------------------
1 | package com.learncamel.alert;
2 |
3 |
4 | import lombok.extern.slf4j.Slf4j;
5 | import org.apache.camel.Exchange;
6 | import org.apache.camel.Processor;
7 | import org.springframework.beans.factory.annotation.Autowired;
8 | import org.springframework.core.env.Environment;
9 | import org.springframework.mail.SimpleMailMessage;
10 | import org.springframework.mail.javamail.JavaMailSender;
11 | import org.springframework.stereotype.Component;
12 |
13 | /**
14 | * Created by Dilip on 1/20/18.
15 | */
16 | @Component
17 | @Slf4j
18 | public class MailProcessor implements Processor {
19 |
20 | @Autowired
21 | public JavaMailSender emailSender;
22 |
23 | @Autowired
24 | Environment environment;
25 |
26 | @Override
27 | public void process(Exchange exchange) throws Exception {
28 |
29 | Exception e = exchange.getProperty(Exchange.EXCEPTION_CAUGHT, Exception.class);
30 | log.info("Error Message in MailProcessor : " + e.getMessage());
31 |
32 | String messageBody = "Exception happened in the route and the exception is " + e.getMessage();
33 |
34 | SimpleMailMessage message = new SimpleMailMessage();
35 | message.setFrom(environment.getProperty("mailFrom"));
36 | message.setTo(environment.getProperty("mailto"));
37 | message.setSubject("Exception in Camel Route");
38 | message.setText(messageBody);
39 |
40 | emailSender.send(message);
41 |
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/camel-spring-boot-boiler-plate/src/main/java/com/learncamel/alert/MailProcessor.java:
--------------------------------------------------------------------------------
1 | package com.learncamel.alert;
2 |
3 |
4 | import lombok.extern.slf4j.Slf4j;
5 | import org.apache.camel.Exchange;
6 | import org.apache.camel.Processor;
7 | import org.springframework.beans.factory.annotation.Autowired;
8 | import org.springframework.core.env.Environment;
9 | import org.springframework.mail.SimpleMailMessage;
10 | import org.springframework.mail.javamail.JavaMailSender;
11 | import org.springframework.stereotype.Component;
12 |
13 | /**
14 | * Created by Dilip on 1/20/18.
15 | */
16 | @Component
17 | @Slf4j
18 | public class MailProcessor implements Processor {
19 |
20 | @Autowired
21 | public JavaMailSender emailSender;
22 |
23 | @Autowired
24 | Environment environment;
25 |
26 | @Override
27 | public void process(Exchange exchange) throws Exception {
28 |
29 | Exception e = exchange.getProperty(Exchange.EXCEPTION_CAUGHT, Exception.class);
30 | log.info("Error Message in MailProcessor : " + e.getMessage());
31 |
32 | String messageBody = "Exception happened in the route and the exception is " + e.getMessage();
33 |
34 | SimpleMailMessage message = new SimpleMailMessage();
35 | message.setFrom(environment.getProperty("mailFrom"));
36 | message.setTo(environment.getProperty("mailto"));
37 | message.setSubject("Exception in Camel Route");
38 | message.setText(messageBody);
39 |
40 | emailSender.send(message);
41 |
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/kafka-learncamel-spring-boot/src/main/java/com/learncamel/alert/MailProcessor.java:
--------------------------------------------------------------------------------
1 | package com.learncamel.alert;
2 |
3 |
4 | import lombok.extern.slf4j.Slf4j;
5 | import org.apache.camel.Exchange;
6 | import org.apache.camel.Processor;
7 | import org.springframework.beans.factory.annotation.Autowired;
8 | import org.springframework.core.env.Environment;
9 | import org.springframework.mail.SimpleMailMessage;
10 | import org.springframework.mail.javamail.JavaMailSender;
11 | import org.springframework.stereotype.Component;
12 |
13 | /**
14 | * Created by Dilip on 1/20/18.
15 | */
16 | @Component
17 | @Slf4j
18 | public class MailProcessor implements Processor {
19 |
20 | @Autowired
21 | public JavaMailSender emailSender;
22 |
23 | @Autowired
24 | Environment environment;
25 |
26 | @Override
27 | public void process(Exchange exchange) throws Exception {
28 |
29 | Exception e = exchange.getProperty(Exchange.EXCEPTION_CAUGHT, Exception.class);
30 | log.info("Error Message in MailProcessor : " + e.getMessage());
31 |
32 | String messageBody = "Exception happened in the route and the exception is " + e.getMessage();
33 |
34 | SimpleMailMessage message = new SimpleMailMessage();
35 | message.setFrom(environment.getProperty("mailFrom"));
36 | message.setTo(environment.getProperty("mailto"));
37 | message.setSubject("Exception in Camel Route");
38 | message.setText(messageBody);
39 |
40 | // emailSender.send(message);
41 |
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/rest-learncamel-spring-boot/src/main/java/com/learncamel/alert/MailProcessor.java:
--------------------------------------------------------------------------------
1 | package com.learncamel.alert;
2 |
3 |
4 | import lombok.extern.slf4j.Slf4j;
5 | import org.apache.camel.Exchange;
6 | import org.apache.camel.Processor;
7 | import org.springframework.beans.factory.annotation.Autowired;
8 | import org.springframework.core.env.Environment;
9 | import org.springframework.mail.SimpleMailMessage;
10 | import org.springframework.mail.javamail.JavaMailSender;
11 | import org.springframework.stereotype.Component;
12 |
13 | /**
14 | * Created by Dilip on 1/20/18.
15 | */
16 | @Component
17 | @Slf4j
18 | public class MailProcessor implements Processor {
19 |
20 | @Autowired
21 | public JavaMailSender emailSender;
22 |
23 | @Autowired
24 | Environment environment;
25 |
26 | @Override
27 | public void process(Exchange exchange) throws Exception {
28 |
29 | Exception e = exchange.getProperty(Exchange.EXCEPTION_CAUGHT, Exception.class);
30 | log.info("Error Message in MailProcessor : " + e.getMessage());
31 |
32 | String messageBody = "Exception happened in the route and the exception is " + e.getMessage();
33 |
34 | SimpleMailMessage message = new SimpleMailMessage();
35 | message.setFrom(environment.getProperty("mailFrom"));
36 | message.setTo(environment.getProperty("mailto"));
37 | message.setSubject("Exception in Camel Route");
38 | message.setText(messageBody);
39 |
40 | emailSender.send(message);
41 |
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/rest-learncamel-spring-boot-with-mockito/src/main/java/com/learncamel/routes/HealthCheckRoute.java:
--------------------------------------------------------------------------------
1 | package com.learncamel.routes;
2 |
3 | import com.learncamel.alert.MailProcessor;
4 | import com.learncamel.processor.HealthCheckProcessor;
5 | import org.apache.camel.Predicate;
6 | import org.apache.camel.builder.RouteBuilder;
7 | import org.springframework.beans.factory.annotation.Autowired;
8 | import org.springframework.stereotype.Component;
9 |
10 | /**
11 | * Created by Dilip on 2/10/18.
12 | */
13 | @Component
14 | public class HealthCheckRoute extends RouteBuilder{
15 |
16 |
17 | @Autowired
18 | HealthCheckProcessor healthCheckProcessor;
19 |
20 | @Autowired
21 | MailProcessor mailProcessor;
22 |
23 | Predicate isNotDev = header("env").isNotEqualTo("mock");
24 |
25 |
26 | @Override
27 | public void configure() throws Exception {
28 |
29 | from("{{healthRoute}}").routeId("healthRoute")
30 | .choice() // Content based EIP
31 | .when(isNotDev) // not dev check
32 | .pollEnrich("http://localhost:8080/health")
33 | .end()
34 | .process(healthCheckProcessor)
35 | .choice()
36 | .when(header("error").isEqualTo(true))
37 | .choice()
38 | .when(isNotDev)
39 | .process(mailProcessor)
40 | .end()
41 | .end();
42 |
43 |
44 |
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/soap-springws-learncamel-spring-boot/src/main/java/com/learncamel/routes/HealthCheckRoute.java:
--------------------------------------------------------------------------------
1 | package com.learncamel.routes;
2 |
3 | import com.learncamel.alert.MailProcessor;
4 | import com.learncamel.processor.HealthCheckProcessor;
5 | import org.apache.camel.Predicate;
6 | import org.apache.camel.builder.RouteBuilder;
7 | import org.springframework.beans.factory.annotation.Autowired;
8 | import org.springframework.stereotype.Component;
9 |
10 | /**
11 | * Created by Dilip on 2/10/18.
12 | */
13 | //@Component
14 | public class HealthCheckRoute extends RouteBuilder{
15 |
16 |
17 | @Autowired
18 | HealthCheckProcessor healthCheckProcessor;
19 |
20 | @Autowired
21 | MailProcessor mailProcessor;
22 |
23 | Predicate isNotDev = header("env").isNotEqualTo("mock");
24 |
25 |
26 | @Override
27 | public void configure() throws Exception {
28 |
29 | from("{{healthRoute}}").routeId("healthRoute")
30 | .choice() // Content based EIP
31 | .when(isNotDev) // not dev check
32 | .pollEnrich("http://localhost:8080/health")
33 | .end()
34 | .process(healthCheckProcessor)
35 | .choice()
36 | .when(header("error").isEqualTo(true))
37 | .choice()
38 | .when(isNotDev)
39 | .process(mailProcessor)
40 | .end()
41 | .end();
42 |
43 |
44 |
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/rest-learncamel-spring-boot-with-mockito/src/main/java/com/learncamel/alert/MailProcessor.java:
--------------------------------------------------------------------------------
1 | package com.learncamel.alert;
2 |
3 |
4 | import lombok.extern.slf4j.Slf4j;
5 | import org.apache.camel.Exchange;
6 | import org.apache.camel.Processor;
7 | import org.springframework.beans.factory.annotation.Autowired;
8 | import org.springframework.core.env.Environment;
9 | import org.springframework.mail.SimpleMailMessage;
10 | import org.springframework.mail.javamail.JavaMailSender;
11 | import org.springframework.stereotype.Component;
12 |
13 | /**
14 | * Created by Dilip on 1/20/18.
15 | */
16 | @Component
17 | @Slf4j
18 | public class MailProcessor implements Processor {
19 |
20 | @Autowired
21 | public JavaMailSender emailSender;
22 |
23 | @Autowired
24 | Environment environment;
25 |
26 | @Override
27 | public void process(Exchange exchange) throws Exception {
28 |
29 | Exception e = exchange.getProperty(Exchange.EXCEPTION_CAUGHT, Exception.class);
30 | log.info("Error Message in MailProcessor : " + e.getMessage());
31 |
32 | String messageBody = "Exception happened in the route and the exception is " + e.getMessage();
33 |
34 | SimpleMailMessage message = new SimpleMailMessage();
35 | message.setFrom(environment.getProperty("mailFrom"));
36 | message.setTo(environment.getProperty("mailto"));
37 | message.setSubject("Exception in Camel Route");
38 | message.setText(messageBody);
39 |
40 | emailSender.send(message);
41 |
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/soap-springws-learncamel-spring-boot/src/main/java/com/learncamel/alert/MailProcessor.java:
--------------------------------------------------------------------------------
1 | package com.learncamel.alert;
2 |
3 |
4 | import lombok.extern.slf4j.Slf4j;
5 | import org.apache.camel.Exchange;
6 | import org.apache.camel.Processor;
7 | import org.springframework.beans.factory.annotation.Autowired;
8 | import org.springframework.core.env.Environment;
9 | import org.springframework.mail.SimpleMailMessage;
10 | import org.springframework.mail.javamail.JavaMailSender;
11 | import org.springframework.stereotype.Component;
12 |
13 | /**
14 | * Created by Dilip on 1/20/18.
15 | */
16 | //@Component
17 | @Slf4j
18 | public class MailProcessor implements Processor {
19 |
20 | @Autowired
21 | public JavaMailSender emailSender;
22 |
23 | @Autowired
24 | Environment environment;
25 |
26 | @Override
27 | public void process(Exchange exchange) throws Exception {
28 |
29 | Exception e = exchange.getProperty(Exchange.EXCEPTION_CAUGHT, Exception.class);
30 | log.info("Error Message in MailProcessor : " + e.getMessage());
31 |
32 | String messageBody = "Exception happened in the route and the exception is " + e.getMessage();
33 |
34 | SimpleMailMessage message = new SimpleMailMessage();
35 | message.setFrom(environment.getProperty("mailFrom"));
36 | message.setTo(environment.getProperty("mailto"));
37 | message.setSubject("Exception in Camel Route");
38 | message.setText(messageBody);
39 |
40 | emailSender.send(message);
41 |
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/learncamel-spring-boot/src/main/java/com/learncamel/routes/HealthCheckRoute.java:
--------------------------------------------------------------------------------
1 | package com.learncamel.routes;
2 |
3 | import com.learncamel.alert.MailProcessor;
4 | import com.learncamel.processor.HealthCheckProcessor;
5 | import org.apache.camel.Exchange;
6 | import org.apache.camel.Predicate;
7 | import org.apache.camel.builder.RouteBuilder;
8 | import org.springframework.beans.factory.annotation.Autowired;
9 | import org.springframework.stereotype.Component;
10 |
11 | /**
12 | * Created by Dilip on 2/10/18.
13 | */
14 | @Component
15 | public class HealthCheckRoute extends RouteBuilder{
16 |
17 |
18 | @Autowired
19 | HealthCheckProcessor healthCheckProcessor;
20 |
21 | @Autowired
22 | MailProcessor mailProcessor;
23 |
24 | Predicate isNotDev = header("env").isNotEqualTo("mock");
25 |
26 |
27 | @Override
28 | public void configure() throws Exception {
29 |
30 | from("{{healthRoute}}").routeId("healthRoute")
31 | .choice() // Content based EIP
32 | .when(isNotDev) // not dev check
33 | .pollEnrich("http://localhost:8081/health")
34 | .end()
35 | .process(healthCheckProcessor)
36 | .choice()
37 | .when(header("error").isEqualTo(true))
38 | .choice()
39 | .when(isNotDev)
40 | .process(mailProcessor)
41 | .end()
42 | .end();
43 |
44 |
45 |
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/activemq-learncamel-spring-boot/src/main/java/com/learncamel/domain/Item.java:
--------------------------------------------------------------------------------
1 | package com.learncamel.domain;
2 |
3 |
4 | import java.math.BigDecimal;
5 |
6 | /**
7 | * Created by Dilip on 2/1/18.
8 | */
9 | public class Item {
10 |
11 | private String transactionType;
12 |
13 | private String sku;
14 |
15 | private String itemDescription;
16 |
17 | private BigDecimal price;
18 |
19 | public String getTransactionType() {
20 | return transactionType;
21 | }
22 |
23 | public void setTransactionType(String transactionType) {
24 | this.transactionType = transactionType;
25 | }
26 |
27 | public String getSku() {
28 | return sku;
29 | }
30 |
31 | public void setSku(String sku) {
32 | this.sku = sku;
33 | }
34 |
35 | public String getItemDescription() {
36 | return itemDescription;
37 | }
38 |
39 | public void setItemDescription(String itemDescription) {
40 | this.itemDescription = itemDescription;
41 | }
42 |
43 | public BigDecimal getPrice() {
44 | return price;
45 | }
46 |
47 | @Override
48 | public String toString() {
49 | return "Item{" +
50 | "transactionType='" + transactionType + '\'' +
51 | ", sku='" + sku + '\'' +
52 | ", itemDescription='" + itemDescription + '\'' +
53 | ", price=" + price +
54 | '}';
55 | }
56 |
57 | public void setPrice(BigDecimal price) {
58 | this.price = price;
59 | }
60 |
61 |
62 | }
63 |
--------------------------------------------------------------------------------
/kafka-learncamel-spring-boot/src/main/java/com/learncamel/domain/Item.java:
--------------------------------------------------------------------------------
1 | package com.learncamel.domain;
2 |
3 |
4 | import java.math.BigDecimal;
5 |
6 | /**
7 | * Created by Dilip on 2/1/18.
8 | */
9 | public class Item {
10 |
11 | private String transactionType;
12 |
13 | private String sku;
14 |
15 | private String itemDescription;
16 |
17 | private BigDecimal price;
18 |
19 | public String getTransactionType() {
20 | return transactionType;
21 | }
22 |
23 | public void setTransactionType(String transactionType) {
24 | this.transactionType = transactionType;
25 | }
26 |
27 | public String getSku() {
28 | return sku;
29 | }
30 |
31 | public void setSku(String sku) {
32 | this.sku = sku;
33 | }
34 |
35 | public String getItemDescription() {
36 | return itemDescription;
37 | }
38 |
39 | public void setItemDescription(String itemDescription) {
40 | this.itemDescription = itemDescription;
41 | }
42 |
43 | public BigDecimal getPrice() {
44 | return price;
45 | }
46 |
47 | @Override
48 | public String toString() {
49 | return "Item{" +
50 | "transactionType='" + transactionType + '\'' +
51 | ", sku='" + sku + '\'' +
52 | ", itemDescription='" + itemDescription + '\'' +
53 | ", price=" + price +
54 | '}';
55 | }
56 |
57 | public void setPrice(BigDecimal price) {
58 | this.price = price;
59 | }
60 |
61 |
62 | }
63 |
--------------------------------------------------------------------------------
/activemq-learncamel-spring-boot/src/main/java/com/learncamel/processor/BuildSQLProcessor.java:
--------------------------------------------------------------------------------
1 | package com.learncamel.processor;
2 |
3 | import com.learncamel.domain.Item;
4 | import lombok.extern.slf4j.Slf4j;
5 | import org.apache.camel.Exchange;
6 | import org.springframework.stereotype.Component;
7 |
8 | /**
9 | * Created by Dilip on 2/3/18.
10 | */
11 | @Component
12 | @Slf4j
13 | public class BuildSQLProcessor implements org.apache.camel.Processor {
14 | @Override
15 | public void process(Exchange exchange) throws Exception {
16 |
17 | Item item = (Item) exchange.getIn().getBody();
18 | log.info(" Item in BuildSQLProcessor is : " + item);
19 | String tableName ="ITEMS";
20 | StringBuilder query = new StringBuilder();
21 |
22 | if(item.getTransactionType().equals("ADD")){
23 | query.append("INSERT INTO "+tableName+ " (SKU, ITEM_DESCRIPTION,PRICE) VALUES ('");
24 | query.append(item.getSku()+"','"+item.getItemDescription()+"',"+item.getPrice()+");");
25 |
26 | }else if(item.getTransactionType().equals("UPDATE")){
27 | query.append("UPDATE "+tableName+" SET PRICE =");
28 | query.append(item.getPrice()+" where SKU = '"+item.getSku()+"'");
29 |
30 | }else if(item.getTransactionType().equals("DELETE")){
31 | query.append("DELETE FROM " + tableName + " where SKU = '"+item.getSku()+"'");
32 | }
33 | log.info("Final Query is : " + query);
34 | exchange.getIn().setBody(query.toString());
35 | exchange.getIn().setHeader("skuId", item.getSku());
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/soap-springws-learncamel-spring-boot/src/main/java/com/learncamel/processor/RequestXMLBuildProcessor.java:
--------------------------------------------------------------------------------
1 | package com.learncamel.processor;
2 |
3 | import lombok.extern.slf4j.Slf4j;
4 | import org.apache.camel.Exchange;
5 | import org.apache.camel.Processor;
6 | import org.apache.camel.component.spring.ws.SpringWebserviceConstants;
7 | import org.springframework.stereotype.Component;
8 |
9 | import java.util.Arrays;
10 | import java.util.List;
11 | import java.util.Random;
12 |
13 | @Component
14 | @Slf4j
15 | public class RequestXMLBuildProcessor implements Processor{
16 |
17 | List countryList = Arrays.asList("US","IN", "GB","CN","JP");
18 |
19 | String countryWebServiceUri = "http://www.oorsprong.org/websamples.countryinfo/CountryInfoService.wso";
20 |
21 | @Override
22 | public void process(Exchange exchange) throws Exception {
23 |
24 | Random random = new Random();
25 | String countryCode = countryList.get(random.nextInt(countryList.size()-1));
26 |
27 | String inputXML = buildXmlString().replace("ABC",countryCode);
28 |
29 | log.info("Input XML is : " + inputXML );
30 |
31 | exchange.getIn().setBody(inputXML);
32 | exchange.getIn().setHeader(SpringWebserviceConstants.SPRING_WS_ENDPOINT_URI, countryWebServiceUri);
33 |
34 |
35 |
36 | }
37 |
38 | private String buildXmlString(){
39 |
40 | return " \n" +
41 | " ABC\n" +
42 | " ";
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/camel-spring-boot-boiler-plate/src/main/java/com/learncamel/routes/SimpleCamelRoute.java:
--------------------------------------------------------------------------------
1 | package com.learncamel.routes;
2 |
3 | import com.learncamel.alert.MailProcessor;
4 | import com.learncamel.exception.DataException;
5 | import org.apache.camel.LoggingLevel;
6 | import org.apache.camel.builder.RouteBuilder;
7 | import org.postgresql.util.PSQLException;
8 | import org.springframework.beans.factory.annotation.Autowired;
9 | import org.springframework.beans.factory.annotation.Qualifier;
10 | import org.springframework.core.env.Environment;
11 | import org.springframework.stereotype.Component;
12 |
13 | import javax.sql.DataSource;
14 |
15 | /**
16 | * Created by Dilip on 1/3/18.
17 | */
18 | @Component
19 | public class SimpleCamelRoute extends RouteBuilder{
20 |
21 | @Autowired
22 | Environment environment;
23 |
24 | @Qualifier("dataSource")
25 | @Autowired
26 | DataSource dataSource;
27 |
28 | @Autowired
29 | MailProcessor mailProcessor;
30 |
31 |
32 | @Override
33 | public void configure() throws Exception {
34 |
35 | onException(PSQLException.class).log(LoggingLevel.ERROR,"PSQLException in the route ${body}")
36 | .maximumRedeliveries(3).redeliveryDelay(3000).backOffMultiplier(2).retryAttemptedLogLevel(LoggingLevel.ERROR);
37 |
38 | onException(DataException.class,RuntimeException.class).log(LoggingLevel.ERROR, "DataException in the route ${body}")
39 | .process(mailProcessor);
40 |
41 |
42 | from("{{fromRoute}}")
43 | .log("Current Environment is "+ environment.getProperty("message"))
44 | .to("{{toRoute}}");
45 |
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/simple-rest-api/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 | 4.0.0
5 |
6 | com.learnspringboot
7 | simple-rest-api
8 | 0.0.1-SNAPSHOT
9 | jar
10 |
11 | simple-rest-api
12 | Demo project for Spring Boot
13 |
14 |
15 | org.springframework.boot
16 | spring-boot-starter-parent
17 | 1.5.9.RELEASE
18 |
19 |
20 |
21 |
22 | UTF-8
23 | UTF-8
24 | 1.8
25 |
26 |
27 |
28 |
29 | org.springframework.boot
30 | spring-boot-starter-web
31 |
32 |
33 |
34 | org.springframework.boot
35 | spring-boot-starter-test
36 | test
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 | org.springframework.boot
45 | spring-boot-maven-plugin
46 |
47 |
48 |
49 |
50 |
51 |
52 |
--------------------------------------------------------------------------------
/kafka-learncamel-spring-boot/src/main/java/com/learncamel/processor/BuildSQLProcessor.java:
--------------------------------------------------------------------------------
1 | package com.learncamel.processor;
2 |
3 | import com.learncamel.domain.Item;
4 | import com.learncamel.exception.DataException;
5 | import lombok.extern.slf4j.Slf4j;
6 | import org.apache.camel.Exchange;
7 | import org.springframework.stereotype.Component;
8 | import org.springframework.util.ObjectUtils;
9 |
10 | /**
11 | * Created by Dilip on 2/3/18.
12 | */
13 | @Component
14 | @Slf4j
15 | public class BuildSQLProcessor implements org.apache.camel.Processor {
16 | @Override
17 | public void process(Exchange exchange) throws Exception {
18 |
19 | Item item = (Item) exchange.getIn().getBody();
20 | log.info(" Item in BuildSQLProcessor is : " + item);
21 | String tableName ="ITEMS";
22 | StringBuilder query = new StringBuilder();
23 |
24 | if(item.getTransactionType().equals("ADD")){
25 | query.append("INSERT INTO "+tableName+ " (SKU, ITEM_DESCRIPTION,PRICE) VALUES ('");
26 | query.append(item.getSku()+"','"+item.getItemDescription()+"',"+item.getPrice()+");");
27 |
28 | }else if(item.getTransactionType().equals("UPDATE")){
29 | query.append("UPDATE "+tableName+" SET PRICE =");
30 | query.append(item.getPrice()+" where SKU = '"+item.getSku()+"'");
31 |
32 | }else if(item.getTransactionType().equals("DELETE")){
33 | query.append("DELETE FROM " + tableName + " where SKU = '"+item.getSku()+"'");
34 | }
35 | log.info("Final Query is : " + query);
36 | exchange.getIn().setBody(query.toString());
37 | exchange.getIn().setHeader("skuId", item.getSku());
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/camel-spring-boot-boiler-plate/src/main/java/com/learncamel/processor/HealthCheckProcessor.java:
--------------------------------------------------------------------------------
1 | package com.learncamel.processor;
2 |
3 | import com.fasterxml.jackson.core.type.TypeReference;
4 | import com.fasterxml.jackson.databind.ObjectMapper;
5 | import lombok.extern.slf4j.Slf4j;
6 | import org.apache.camel.Exchange;
7 | import org.apache.camel.Processor;
8 | import org.springframework.stereotype.Component;
9 |
10 | import java.util.Map;
11 |
12 | /**
13 | * Created by Dilip on 2/10/18.
14 | */
15 | @Component
16 | @Slf4j
17 | public class HealthCheckProcessor implements Processor {
18 |
19 | @Override
20 | public void process(Exchange exchange) throws Exception {
21 |
22 | String healthCheckResult = (String) exchange.getIn().getBody(String.class);
23 |
24 | log.info("Health String of the APP is" + healthCheckResult);
25 | ObjectMapper objectMapper = new ObjectMapper();
26 | Map map = objectMapper.readValue(healthCheckResult, new TypeReference