Git Product home page Git Product logo

cna-demo's Introduction

cna demo Project

  1. msaez 에서 모델링
  2. IntelliJ 에서 소스 open
  3. 프로그램 수정

order

  • sync I/F를 위해 Feign 에서 사용할 다른 서비스의 URL을 환경별로 다르게 적용되도록 변수로 추가 @resources/application.yml
    profile: default
    api:
        url:
            delivery: http://localhost:8082
    ----
    profile: docker
    api:
        url:
            delivery: http://delivery:8082
  • Feign 을 사용하는 java 파일에서 url 지정 @external/CancellationService.java
     @FeignClient(name="delivery", url="http://delivery:8080")
     -->
     @FeignClient(name="delivery", url="${api.url.delivery}") 

delivery

  • Shipped Event Biz-Logic 구현 @PolicyHandler
@Service
public class PolicyHandler{
    @StreamListener(KafkaProcessor.INPUT)
    public void onStringEventListener(@Payload String eventString){

    }

    @Autowired
    DeliveryRepository deliveryRepository;

    @StreamListener(KafkaProcessor.INPUT)
    public void wheneverOrdered_Ship(@Payload Ordered ordered){

        if(ordered.isMe()){
            Delivery delivery = new Delivery();
            delivery.setOrderId(ordered.getId());
            delivery.setStatus("SHIPPED");

            deliveryRepository.save(delivery);
        }
    }
}

gateway

  • gateway 의 predicates 가 2개 이상인 경우 URL 사이에 , 추가
  - Path=/deliveries/**/cancellations/** 
    --> 
  - Path=/deliveries/**,/cancelllations/**
  • 포트를 통한 서비스 실행 확인
netstat -ano | findstr PID :808

kafka

참고 : apache-kafka installation on mac

  • install on mac
brew install kafka
  • Start Zookeeper
# Windows
cd kafka/bin/windows
zookeeper-server-start.bat ../../config/zookeeper.properties

# Mac
zookeeper-server-start /usr/local/etc/kafka/zookeeper.properties
  • Start Kafka Server
# Windows
cd kafka/bin/windows
kafka-server-start.bat ../../config/server.properties

# Mac
kafka-server-start /usr/local/etc/kafka/server.properties
  • Topic 이름 확인
 @resources/application.yml
 spring.cloud.stream.bindings.event-out.destination
  • Create Kafka Topic
kafka-topics --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic cnademo
  • List of Topics
kafka-topics --zookeeper localhost:2181 --list
  • Initialize Producer console
kafka-console-producer --broker-list localhost:9092 --topic cnademo
  • Initialize Consumer console
kafka-console-consumer --bootstrap-server localhost:9092 --topic cnademo --from-beginning

cna-demo's People

Contributors

aimmvp avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.