Skip to content

Commit

Permalink
no message
Browse files Browse the repository at this point in the history
  • Loading branch information
jinyoung committed Nov 22, 2018
1 parent 7575961 commit dbf099a
Show file tree
Hide file tree
Showing 9 changed files with 125 additions and 0 deletions.
15 changes: 15 additions & 0 deletions marketing/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<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>com.uengine</groupId>
<artifactId>education</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>

<artifactId>marketing</artifactId>

</project>
12 changes: 12 additions & 0 deletions marketing/src/main/java/com/uengine/education/Application.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package com.uengine.education;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class Application {

public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package com.uengine.education;

import java.util.Date;

/**
* Created by uengine on 2018. 11. 21..
*/
public class ClazzDayRegistered {

String instructorName;

public String getInstructorName() {
return instructorName;
}

public void setInstructorName(String instructorName) {
this.instructorName = instructorName;
}



}
23 changes: 23 additions & 0 deletions marketing/src/main/java/com/uengine/education/EventListener.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package com.uengine.education;

import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.stream.annotation.StreamListener;
import org.springframework.messaging.handler.annotation.Payload;
import org.springframework.stereotype.Component;

@Component
public class EventListener {

/** version 1. callback version **/
@StreamListener(Streams.INPUT)
@JsonDeserialize(as = ClazzDayRegistered.class)
public void handleClazzDay(@Payload ClazzDayRegistered clazzDayRegistered) {

System.out.println("<이메일 발송>");
System.out.println("제목: " + clazzDayRegistered.getInstructorName() +" 강사의 OOO강의 [마감임박]");


}

}
12 changes: 12 additions & 0 deletions marketing/src/main/java/com/uengine/education/Streams.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package com.uengine.education;

import org.springframework.cloud.stream.annotation.Input;
import org.springframework.messaging.SubscribableChannel;

public interface Streams {
String INPUT = "class-topic";

@Input(INPUT)
SubscribableChannel inboundGreetings();

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package com.uengine.education;

import org.springframework.cloud.stream.annotation.EnableBinding;

@EnableBinding(Streams.class)
public class StreamsConfig {

}

15 changes: 15 additions & 0 deletions marketing/src/main/resources/application.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
spring:
cloud:
stream:
kafka:
binder:
brokers: education-kafka:9092 # ${vcap.services.kakfa.host_port} and inject value from env variable
zkNodes: education-kafka-zookeeper:2181
bindings:
class-topic:
destination: class.topic
contentType: application/json

eureka:
client:
enabled: false
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package com.uengine.education;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

@RunWith(SpringRunner.class)
@SpringBootTest
public class EducationApplicationTests {

@Test
public void contextLoads() {
}

}
1 change: 1 addition & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

<module>course</module>
<module>calendar</module>
<module>marketing</module>

</modules>

Expand Down

0 comments on commit dbf099a

Please sign in to comment.