Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CDI monitoring example #10

Closed
wants to merge 10 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ release.properties
dependency-reduced-pom.xml
buildNumber.properties
.idea
*.log
*.log*
*.iml
2 changes: 1 addition & 1 deletion demos/openalt-2015/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<groupId>io.silverware.demos</groupId>
<artifactId>demos-parent</artifactId>
<version>1.0-SNAPSHOT</version>
<version>1.0</version>
</parent>
<artifactId>openalt-2015</artifactId>
<packaging>jar</packaging>
Expand Down
4 changes: 3 additions & 1 deletion demos/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>io.silverware.demos</groupId>
<artifactId>demos-parent</artifactId>
<version>1.0-SNAPSHOT</version>
<version>1.0</version>
<packaging>pom</packaging>
<name>SilverWare Demos Parent</name>
<description>Parent pom of SilverWare Demos.</description>
Expand Down Expand Up @@ -115,6 +115,8 @@
<classpathPrefix>lib/</classpathPrefix>
</manifest>
<manifestEntries>
<Specification-Version>${project.version}</Specification-Version>
<Implementation-Version>${project.version}</Implementation-Version>
</manifestEntries>
</archive>
</configuration>
Expand Down
4 changes: 4 additions & 0 deletions quickstarts/camel-cdi-helloworld/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Shows integration of Camel and CDI using camel-cdi component.

mvn clean package
mvn exec:exec
27 changes: 27 additions & 0 deletions quickstarts/camel-cdi-helloworld/log4j2.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="debug">
<Appenders>
<Console name="CONSOLE" target="SYSTEM_OUT">
<PatternLayout pattern="%d %-5p [%t] {%c} %m%n"/>
</Console>
<RollingFile name="ROLLING" fileName="./silverware.log" filePattern="./silverware.log.%d{yyyy-MM-dd}">
<PatternLayout pattern="%d %-5p [%t] {%c} %m%n"/>
<Policies>
<TimeBasedTriggeringPolicy />
</Policies>
<DefaultRolloverStrategy max="10"/>
</RollingFile>
<Async name="ASYNC">
<AppenderRef ref="ROLLING"/>
<AppenderRef ref="CONSOLE"/>
</Async>
</Appenders>
<Loggers>
<Logger name="com" level="info"/>
<Logger name="org" level="info"/>
<Logger name="io.silverware" level="debug"/>
<Root level="debug">
<AppenderRef ref="ASYNC"/>
</Root>
</Loggers>
</Configuration>
46 changes: 46 additions & 0 deletions quickstarts/camel-cdi-helloworld/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>io.silverware.demos.quickstarts</groupId>
<artifactId>quickstarts-parent</artifactId>
<version>1.0</version>
</parent>
<artifactId>camel-cdi-helloworld</artifactId>
<packaging>jar</packaging>
<dependencies>
<dependency>
<groupId>io.silverware</groupId>
<artifactId>microservices</artifactId>
</dependency>
<dependency>
<groupId>io.silverware</groupId>
<artifactId>cdi-microservice-provider</artifactId>
</dependency>
<dependency>
<groupId>io.silverware</groupId>
<artifactId>camel-microservice-provider</artifactId>
</dependency>
<dependency>
<groupId>io.silverware</groupId>
<artifactId>camel-cdi-integration</artifactId>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-stream</artifactId>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>${version.maven.dependency.plugin}</version>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
/*
* -----------------------------------------------------------------------\
* SilverWare
*  
* Copyright (C) 2010 - 2013 the original author or authors.
*  
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* -----------------------------------------------------------------------/
*/
package io.silverware.demos.quickstarts.cdi;

import io.silverware.microservices.annotations.Microservice;
import io.silverware.microservices.providers.cdi.MicroservicesStartedEvent;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

import javax.annotation.PostConstruct;
import javax.enterprise.event.Observes;

/**
* @author <a href="mailto:[email protected]">Martin Večeřa</a>
*/
@Microservice("camelCdiMicroservice")
public class CamelCdiMicroservice {

private static final Logger log = LogManager.getLogger(CamelCdiMicroservice.class);

public CamelCdiMicroservice() {
log.info("CamelCdiMicroservice constructor");
}

@PostConstruct
public void onInit() {
log.info("CamelCdiMicroservice PostConstruct " + this.getClass().getName());
}

public void hello() {
log.info("CamelCdiMicroservice Hello");
}

public String sayHello(final String msg) {
return "Answering '" + msg + "' with 'How do you do!'";
}

public void eventObserver(@Observes MicroservicesStartedEvent event) {
log.info("CamelCdiMicroservice MicroservicesStartedEvent");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*
* -----------------------------------------------------------------------\
* SilverWare
*  
* Copyright (C) 2010 - 2013 the original author or authors.
*  
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* -----------------------------------------------------------------------/
*/
package io.silverware.demos.quickstarts.cdi;

import org.apache.camel.builder.RouteBuilder;

/**
* @author <a href="mailto:[email protected]">Martin Večeřa</a>
*/
public class CamelCdiRoute extends RouteBuilder {

@Override
public void configure() throws Exception {
from("timer://foo?period=2000")
.setBody().simple("Hello from Camel Timer!")
.beanRef("camelCdiMicroservice", "sayHello")
.to("log:test").to("stream:out");
}

}
Empty file.
2 changes: 2 additions & 0 deletions quickstarts/camel-helloworld-xml/README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
Microservice represented by Apache Camel as a route specified in an XML file.

mvn clean package
java -jar target/camel-helloworld-*.jar
27 changes: 27 additions & 0 deletions quickstarts/camel-helloworld-xml/log4j2.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="debug">
<Appenders>
<Console name="CONSOLE" target="SYSTEM_OUT">
<PatternLayout pattern="%d %-5p [%t] {%c} %m%n"/>
</Console>
<RollingFile name="ROLLING" fileName="./silverware.log" filePattern="./silverware.log.%d{yyyy-MM-dd}">
<PatternLayout pattern="%d %-5p [%t] {%c} %m%n"/>
<Policies>
<TimeBasedTriggeringPolicy />
</Policies>
<DefaultRolloverStrategy max="10"/>
</RollingFile>
<Async name="ASYNC">
<AppenderRef ref="ROLLING"/>
<AppenderRef ref="CONSOLE"/>
</Async>
</Appenders>
<Loggers>
<Logger name="com" level="info"/>
<Logger name="org" level="info"/>
<Logger name="io.silverware" level="debug"/>
<Root level="debug">
<AppenderRef ref="ASYNC"/>
</Root>
</Loggers>
</Configuration>
2 changes: 1 addition & 1 deletion quickstarts/camel-helloworld-xml/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<groupId>io.silverware.demos.quickstarts</groupId>
<artifactId>quickstarts-parent</artifactId>
<version>1.0-SNAPSHOT</version>
<version>1.0</version>
</parent>
<artifactId>camel-helloworld-xml</artifactId>
<packaging>jar</packaging>
Expand Down
2 changes: 2 additions & 0 deletions quickstarts/camel-helloworld/README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
Microservice represented by Apache Camel as a route specified in a Java class.

mvn clean package
java -jar target/camel-helloworld-*.jar
27 changes: 27 additions & 0 deletions quickstarts/camel-helloworld/log4j2.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="debug">
<Appenders>
<Console name="CONSOLE" target="SYSTEM_OUT">
<PatternLayout pattern="%d %-5p [%t] {%c} %m%n"/>
</Console>
<RollingFile name="ROLLING" fileName="./silverware.log" filePattern="./silverware.log.%d{yyyy-MM-dd}">
<PatternLayout pattern="%d %-5p [%t] {%c} %m%n"/>
<Policies>
<TimeBasedTriggeringPolicy />
</Policies>
<DefaultRolloverStrategy max="10"/>
</RollingFile>
<Async name="ASYNC">
<AppenderRef ref="ROLLING"/>
<AppenderRef ref="CONSOLE"/>
</Async>
</Appenders>
<Loggers>
<Logger name="com" level="info"/>
<Logger name="org" level="info"/>
<Logger name="io.silverware" level="debug"/>
<Root level="debug">
<AppenderRef ref="ASYNC"/>
</Root>
</Loggers>
</Configuration>
2 changes: 1 addition & 1 deletion quickstarts/camel-helloworld/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<groupId>io.silverware.demos.quickstarts</groupId>
<artifactId>quickstarts-parent</artifactId>
<version>1.0-SNAPSHOT</version>
<version>1.0</version>
</parent>
<artifactId>camel-helloworld</artifactId>
<packaging>jar</packaging>
Expand Down
4 changes: 4 additions & 0 deletions quickstarts/camel-jetty-cdi/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Exposes a CDI service with a REST interface using Camel Jetty component.

mvn clean package
mvn exec:exec
27 changes: 27 additions & 0 deletions quickstarts/camel-jetty-cdi/log4j2.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="debug">
<Appenders>
<Console name="CONSOLE" target="SYSTEM_OUT">
<PatternLayout pattern="%d %-5p [%t] {%c} %m%n"/>
</Console>
<RollingFile name="ROLLING" fileName="./silverware.log" filePattern="./silverware.log.%d{yyyy-MM-dd}">
<PatternLayout pattern="%d %-5p [%t] {%c} %m%n"/>
<Policies>
<TimeBasedTriggeringPolicy />
</Policies>
<DefaultRolloverStrategy max="10"/>
</RollingFile>
<Async name="ASYNC">
<AppenderRef ref="ROLLING"/>
<AppenderRef ref="CONSOLE"/>
</Async>
</Appenders>
<Loggers>
<Logger name="com" level="info"/>
<Logger name="org" level="info"/>
<Logger name="io.silverware" level="debug"/>
<Root level="debug">
<AppenderRef ref="ASYNC"/>
</Root>
</Loggers>
</Configuration>
41 changes: 41 additions & 0 deletions quickstarts/camel-jetty-cdi/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>io.silverware.demos.quickstarts</groupId>
<artifactId>quickstarts-parent</artifactId>
<version>1.0</version>
</parent>
<artifactId>camel-jetty-cdi</artifactId>
<packaging>jar</packaging>
<dependencies>
<dependency>
<groupId>io.silverware</groupId>
<artifactId>microservices</artifactId>
</dependency>
<dependency>
<groupId>io.silverware</groupId>
<artifactId>cdi-microservice-provider</artifactId>
</dependency>
<dependency>
<groupId>io.silverware</groupId>
<artifactId>camel-microservice-provider</artifactId>
</dependency>
<dependency>
<groupId>io.silverware</groupId>
<artifactId>camel-cdi-integration</artifactId>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-jetty</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>${version.maven.dependency.plugin}</version>
</plugin>
</plugins>
</build>
</project>
Loading