Commit 801065ba authored by Ben Anderson's avatar Ben Anderson

Deployment 58

parent 5061bffd
......@@ -14,7 +14,7 @@ spec:
spec:
containers:
- name: afp-prods-container
image: nexus.mynisum.com/afp-prods:57
image: nexus.mynisum.com/afp-prods:58
imagePullPolicy: Always
ports:
- containerPort: 8083
......
//package com.nisum.ascend.inventory.configuration;
//
//
//import com.nisum.ascend.inventory.dto.Order;
//import com.nisum.ascend.inventory.dto.WareHouseOrder;
//import lombok.extern.slf4j.Slf4j;
//import org.apache.kafka.clients.consumer.ConsumerConfig;
//import org.apache.kafka.clients.producer.ProducerConfig;
//import org.apache.kafka.common.serialization.StringDeserializer;
//import org.springframework.beans.factory.annotation.Value;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.kafka.support.serializer.JsonDeserializer;
//import reactor.kafka.receiver.KafkaReceiver;
//import reactor.kafka.receiver.ReceiverOptions;
//
//import java.util.Collection;
//import java.util.Collections;
//import java.util.HashMap;
//import java.util.Map;
//
//@Configuration
//@Slf4j
//public class KafkaReceiverConfig {
//
// @Value("${kafka.consumer.bootstrap-servers}")
// private String bootstrapServers;
// @Value("${kafka.consumer.group-id}")
// private String groupId;
//
// @Bean("kafkaWarehouseOrderReceiver")
// public KafkaReceiver<String, String> kafkaWarehouseOrderEventReceiver(
// @Value("${kafka.WAREHOUSETOPIC.input}") String posLogTopic) {
// ReceiverOptions<String, String> receiverOptions = ReceiverOptions.create(WarehouseOrderEventReceiverConfig());
// receiverOptions.maxCommitAttempts(3);
// return KafkaReceiver.create(receiverOptions.addAssignListener(Collection::iterator)
// .subscription(Collections.singleton(posLogTopic)));
// }
//
// private Map<String, Object> WarehouseOrderEventReceiverConfig() {
// Map<String, Object> config = new HashMap<>();
// config.put(ConsumerConfig.GROUP_ID_CONFIG, groupId);
// config.put(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, bootstrapServers);
// config.put(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class);
// config.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class);
// return config;
// }
//
// @Bean("kafkaOrderReceiver")
// public KafkaReceiver<String, String> kafkaOrderEventReceiver(
// @Value("${kafka.ORDERTOPIC.input}") String posLogTopic) {
// ReceiverOptions<String, String> receiverOptions = ReceiverOptions.create(OrderEventReceiverConfig());
// receiverOptions.maxCommitAttempts(3);
// return KafkaReceiver.create(receiverOptions.addAssignListener(Collection::iterator)
// .subscription(Collections.singleton(posLogTopic)));
// }
//
// private Map<String, Object> OrderEventReceiverConfig() {
// Map<String, Object> config = new HashMap<>();
// config.put(ConsumerConfig.GROUP_ID_CONFIG, groupId);
// config.put(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, bootstrapServers);
// config.put(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class);
// config.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class);
// return config;
// }
//
//}
\ No newline at end of file
package com.nisum.ascend.inventory.configuration;
import com.nisum.ascend.inventory.dto.Order;
import com.nisum.ascend.inventory.dto.WareHouseOrder;
import lombok.extern.slf4j.Slf4j;
import org.apache.kafka.clients.consumer.ConsumerConfig;
import org.apache.kafka.clients.producer.ProducerConfig;
import org.apache.kafka.common.serialization.StringDeserializer;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.kafka.support.serializer.JsonDeserializer;
import reactor.kafka.receiver.KafkaReceiver;
import reactor.kafka.receiver.ReceiverOptions;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
@Configuration
@Slf4j
public class KafkaReceiverConfig {
@Value("${kafka.consumer.bootstrap-servers}")
private String bootstrapServers;
@Value("${kafka.consumer.group-id}")
private String groupId;
@Bean("kafkaWarehouseOrderReceiver")
public KafkaReceiver<String, String> kafkaWarehouseOrderEventReceiver(
@Value("${kafka.WAREHOUSETOPIC.input}") String posLogTopic) {
ReceiverOptions<String, String> receiverOptions = ReceiverOptions.create(WarehouseOrderEventReceiverConfig());
receiverOptions.maxCommitAttempts(3);
return KafkaReceiver.create(receiverOptions.addAssignListener(Collection::iterator)
.subscription(Collections.singleton(posLogTopic)));
}
private Map<String, Object> WarehouseOrderEventReceiverConfig() {
Map<String, Object> config = new HashMap<>();
config.put(ConsumerConfig.GROUP_ID_CONFIG, groupId);
config.put(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, bootstrapServers);
config.put(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class);
config.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class);
return config;
}
@Bean("kafkaOrderReceiver")
public KafkaReceiver<String, String> kafkaOrderEventReceiver(
@Value("${kafka.ORDERTOPIC.input}") String posLogTopic) {
ReceiverOptions<String, String> receiverOptions = ReceiverOptions.create(OrderEventReceiverConfig());
receiverOptions.maxCommitAttempts(3);
return KafkaReceiver.create(receiverOptions.addAssignListener(Collection::iterator)
.subscription(Collections.singleton(posLogTopic)));
}
private Map<String, Object> OrderEventReceiverConfig() {
Map<String, Object> config = new HashMap<>();
config.put(ConsumerConfig.GROUP_ID_CONFIG, groupId);
config.put(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, bootstrapServers);
config.put(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class);
config.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class);
return config;
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment