Remove kafka code

pull/909/head
chen.ma 3 years ago
parent aa14ad4d63
commit 441d2d0419

@ -1,56 +0,0 @@
<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>cn.hippo4j</groupId>
<artifactId>hippo4j-example</artifactId>
<version>${revision}</version>
</parent>
<artifactId>hippo4j-spring-boot-starter-adapter-kafka-example</artifactId>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-json</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
<dependency>
<groupId>cn.hippo4j</groupId>
<artifactId>hippo4j-spring-boot-starter-adapter-kafka</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>cn.hippo4j</groupId>
<artifactId>hippo4j-spring-boot-starter</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>cn.hippo4j</groupId>
<artifactId>hippo4j-example-core</artifactId>
<version>${revision}</version>
</dependency>
<dependency>
<groupId>org.springframework.kafka</groupId>
<artifactId>spring-kafka</artifactId>
</dependency>
</dependencies>
</project>

@ -1,31 +0,0 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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 cn.hippo4j.springboot.starter.adapter.kafka.example;
import cn.hippo4j.core.enable.EnableDynamicThreadPool;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
@EnableDynamicThreadPool
public class ServerAdapterKafkaExampleApplication {
public static void main(String[] args) {
SpringApplication.run(ServerAdapterKafkaExampleApplication.class, args);
}
}

@ -1,43 +0,0 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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 cn.hippo4j.springboot.starter.adapter.kafka.example.consumer;
import lombok.extern.slf4j.Slf4j;
import org.apache.kafka.clients.consumer.ConsumerRecord;
import org.springframework.kafka.annotation.KafkaListener;
import org.springframework.kafka.support.Acknowledgment;
import org.springframework.kafka.support.KafkaHeaders;
import org.springframework.messaging.handler.annotation.Header;
import org.springframework.stereotype.Component;
import java.util.Optional;
/**
* Kafka message consumer.
*/
@Slf4j
@Component
public class KafkaMessageConsumer {
@KafkaListener(topics = "kafka_message_hippo4j", groupId = "hippo4j")
public void onMessage(ConsumerRecord<?, ?> record, Acknowledgment ack, @Header(KafkaHeaders.RECEIVED_TOPIC) String topic) {
Optional message = Optional.ofNullable(record.value());
message.ifPresent(each -> log.info(each.toString()));
ack.acknowledge();
}
}

@ -1,55 +0,0 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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 cn.hippo4j.springboot.starter.adapter.kafka.example.produce;
import cn.hippo4j.common.toolkit.IdUtil;
import cn.hippo4j.common.toolkit.JSONUtil;
import cn.hippo4j.example.core.dto.SendMessageDTO;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.kafka.core.KafkaTemplate;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* Kafka message produce.
*/
@Slf4j
@Component
@RestController
@AllArgsConstructor
public class KafkaMessageProduce {
private final KafkaTemplate kafkaTemplate;
private final String TOPIC = "kafka_message_hippo4j";
@GetMapping("/message/send")
public String sendMessage(Integer count) {
for (int i = 0; i < count; i++) {
String keys = IdUtil.randomUUID();
SendMessageDTO payload = SendMessageDTO.builder()
.receiver("156011xxx91")
.uid(keys)
.build();
kafkaTemplate.send(TOPIC, JSONUtil.toJSONString(payload));
}
return "success";
}
}

@ -1,23 +0,0 @@
server.port=8092
spring.profiles.active=dev
spring.dynamic.thread-pool.server-addr=http://localhost:6691
spring.dynamic.thread-pool.namespace=prescription
spring.dynamic.thread-pool.item-id=dynamic-threadpool-example
spring.dynamic.thread-pool.username=admin
spring.dynamic.thread-pool.password=123456
spring.kafka.bootstrap-servers=127.0.0.1:9092
spring.kafka.producer.retries=0
spring.kafka.producer.batch-size=16384
spring.kafka.producer.buffer-memory=33554432
spring.kafka.producer.key-serializer=org.apache.kafka.common.serialization.StringSerializer
spring.kafka.producer.value-serializer=org.apache.kafka.common.serialization.StringSerializer
spring.kafka.producer.acks=1
spring.kafka.consumer.auto-offset-reset=latest
spring.kafka.consumer.enable-auto-commit=false
spring.kafka.consumer.key-deserializer=org.apache.kafka.common.serialization.StringDeserializer
spring.kafka.consumer.value-deserializer=org.apache.kafka.common.serialization.StringDeserializer
spring.kafka.listener.concurrency=2
spring.kafka.listener.ack-mode=manual_immediate
spring.kafka.listener.missing-topics-fatal=false

@ -21,7 +21,6 @@
<module>hippo4j-config-nacos-spring-boot-starter-example</module>
<module>hippo4j-config-apollo-spring-boot-starter-example</module>
<module>hippo4j-config-zookeeper-spring-boot-starter-example</module>
<module>hippo4j-spring-boot-starter-adapter-kafka-example</module>
<module>hippo4j-spring-boot-starter-adapter-rabbitmq-example</module>
<module>hippo4j-spring-boot-starter-adapter-spring-cloud-stream-rabbitmq-example</module>
<module>hippo4j-spring-boot-starter-adapter-spring-cloud-stream-rocketmq-example</module>

@ -215,8 +215,6 @@ export default {
runTimeTemp: {},
typeOptions: [
{ key: 'Dubbo', display_name: 'Dubbo' },
{ key: 'Kafka', display_name: 'Kafka' },
{ key: 'KafkaSpringCloudStream', display_name: 'KafkaSpringCloudStream' },
{ key: 'RocketMQ', display_name: 'RocketMQ' },
{ key: 'RocketMQSpringCloudStream', display_name: 'RocketMQSpringCloudStream' },
{ key: 'RabbitMQ', display_name: 'RabbitMQ' },

@ -215,8 +215,6 @@ export default {
runTimeTemp: {},
typeOptions: [
{ key: 'Dubbo', display_name: 'Dubbo' },
{ key: 'Kafka', display_name: 'Kafka' },
{ key: 'KafkaSpringCloudStream', display_name: 'KafkaSpringCloudStream' },
{ key: 'RocketMQ', display_name: 'RocketMQ' },
{ key: 'RocketMQSpringCloudStream', display_name: 'RocketMQSpringCloudStream' },
{ key: 'RabbitMQ', display_name: 'RabbitMQ' },

@ -215,8 +215,6 @@ export default {
runTimeTemp: {},
typeOptions: [
{ key: 'Dubbo', display_name: 'Dubbo' },
{ key: 'Kafka', display_name: 'Kafka' },
{ key: 'KafkaSpringCloudStream', display_name: 'KafkaSpringCloudStream' },
{ key: 'RocketMQ', display_name: 'RocketMQ' },
{ key: 'RocketMQSpringCloudStream', display_name: 'RocketMQSpringCloudStream' },
{ key: 'RabbitMQ', display_name: 'RabbitMQ' },

@ -227,8 +227,6 @@ export default {
runTimeTemp: {},
typeOptions: [
{ key: 'Dubbo', display_name: 'Dubbo' },
{ key: 'Kafka', display_name: 'Kafka' },
{ key: 'KafkaSpringCloudStream', display_name: 'KafkaSpringCloudStream' },
{ key: 'RocketMQ', display_name: 'RocketMQ' },
{ key: 'RocketMQSpringCloudStream', display_name: 'RocketMQSpringCloudStream' },
{ key: 'RabbitMQ', display_name: 'RabbitMQ' },

@ -214,8 +214,6 @@ export default {
runTimeTemp: {},
typeOptions: [
{ key: 'Dubbo', display_name: 'Dubbo' },
{ key: 'Kafka', display_name: 'Kafka' },
{ key: 'KafkaSpringCloudStream', display_name: 'KafkaSpringCloudStream' },
{ key: 'RocketMQ', display_name: 'RocketMQ' },
{ key: 'RocketMQSpringCloudStream', display_name: 'RocketMQSpringCloudStream' },
{ key: 'RabbitMQ', display_name: 'RabbitMQ' },

@ -215,8 +215,6 @@ export default {
runTimeTemp: {},
typeOptions: [
{ key: 'Dubbo', display_name: 'Dubbo' },
{ key: 'Kafka', display_name: 'Kafka' },
{ key: 'KafkaSpringCloudStream', display_name: 'KafkaSpringCloudStream' },
{ key: 'RocketMQ', display_name: 'RocketMQ' },
{ key: 'RocketMQSpringCloudStream', display_name: 'RocketMQSpringCloudStream' },
{ key: 'RabbitMQ', display_name: 'RabbitMQ' },

@ -214,8 +214,6 @@ export default {
runTimeTemp: {},
typeOptions: [
{ key: 'Dubbo', display_name: 'Dubbo' },
{ key: 'Kafka', display_name: 'Kafka' },
{ key: 'KafkaSpringCloudStream', display_name: 'KafkaSpringCloudStream' },
{ key: 'RocketMQ', display_name: 'RocketMQ' },
{ key: 'RocketMQSpringCloudStream', display_name: 'RocketMQSpringCloudStream' },
{ key: 'RabbitMQ', display_name: 'RabbitMQ' },

@ -215,8 +215,6 @@ export default {
runTimeTemp: {},
typeOptions: [
{ key: 'Dubbo', display_name: 'Dubbo' },
{ key: 'Kafka', display_name: 'Kafka' },
{ key: 'KafkaSpringCloudStream', display_name: 'KafkaSpringCloudStream' },
{ key: 'RocketMQ', display_name: 'RocketMQ' },
{ key: 'RocketMQSpringCloudStream', display_name: 'RocketMQSpringCloudStream' },
{ key: 'RabbitMQ', display_name: 'RabbitMQ' },

Loading…
Cancel
Save