SUPPORT-9561: fix listener
This commit is contained in:
parent
93d276008d
commit
07418603d1
1 changed files with 12 additions and 1 deletions
|
|
@ -1,10 +1,13 @@
|
||||||
package ru.micord.ervu.kafka.listener;
|
package ru.micord.ervu.kafka.listener;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
import java.util.concurrent.atomic.AtomicReference;
|
import java.util.concurrent.atomic.AtomicReference;
|
||||||
|
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.kafka.annotation.KafkaListener;
|
import org.springframework.kafka.annotation.KafkaListener;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
import ru.micord.ervu.audit.constants.AuditConstants;
|
import ru.micord.ervu.audit.constants.AuditConstants;
|
||||||
import ru.micord.ervu.audit.service.AuditService;
|
import ru.micord.ervu.audit.service.AuditService;
|
||||||
import ru.micord.ervu.dao.ExcerptHistoryDao;
|
import ru.micord.ervu.dao.ExcerptHistoryDao;
|
||||||
|
|
@ -17,6 +20,7 @@ import ru.micord.ervu.util.UrlUtils;
|
||||||
/**
|
/**
|
||||||
* @author gulnaz
|
* @author gulnaz
|
||||||
*/
|
*/
|
||||||
|
@Service
|
||||||
public class ExcerptListener {
|
public class ExcerptListener {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
|
|
@ -28,8 +32,11 @@ public class ExcerptListener {
|
||||||
@Autowired
|
@Autowired
|
||||||
private AuditService auditService;
|
private AuditService auditService;
|
||||||
|
|
||||||
|
@Value("${ervu.kafka.group.id}")
|
||||||
|
private String groupId;
|
||||||
|
|
||||||
@KafkaListener(
|
@KafkaListener(
|
||||||
id = "${ervu.kafka.group.id}",
|
id = "#{excerptListener.getGroupId}",
|
||||||
topics = "${ervu.kafka.excerpt.reply.topic}",
|
topics = "${ervu.kafka.excerpt.reply.topic}",
|
||||||
containerFactory = "fileContainerFactory")
|
containerFactory = "fileContainerFactory")
|
||||||
public void listen(String kafkaResponse) {
|
public void listen(String kafkaResponse) {
|
||||||
|
|
@ -79,4 +86,8 @@ public class ExcerptListener {
|
||||||
throw new ExcerptException(e);
|
throw new ExcerptException(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getGroupId() {
|
||||||
|
return groupId + "-" + UUID.randomUUID();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue