Replies: 10 comments 7 replies
-
Hi @garyrussell can you take look it |
Beta Was this translation helpful? Give feedback.
-
This one has the same story and same reporter: #2022. As I said over here: Spring Integration is a library you need for your solution. |
Beta Was this translation helpful? Give feedback.
-
There is nothing built-in to support this; if you don't want to use Spring Integration for some reason, it would be simple for you to create a |
Beta Was this translation helpful? Give feedback.
-
@garyrussell can you show me what's concept for DelegatingKafkaTemplate |
Beta Was this translation helpful? Give feedback.
-
public class MyTemplate {
private final Map<String, KafkaTemplate<String, String>> templates;
public MyTemplate(Map<String, KafkaTemplate<String, String>> templates) {
this.templates = new HashMap<>(templates);
}
public ListenableFuture<SendResult<String, String>> send(String topic, String key,
@Nullable String data) {
KafkaTemplate<String, String> kafkaTemplate = templates.get(topic);
Assert.notNull(kafkaTemplate, "No template for topic " + topic);
return kafkaTemplate.send(topic, key, data);
}
} |
Beta Was this translation helpful? Give feedback.
-
You can't do the conversion on the consumer side; the infrastructure needs consumer records; there is code in the |
Beta Was this translation helpful? Give feedback.
-
@garyrussell , Hi I have successfully build DelegatingKafkaTemplate which implement AppliationContextAware , it will preload all related kafkaTemplated in to one Map , @Component
public class DelegatingKafkaTemplate implements ApplicationContextAware {
private ApplicationContext applicationContext;
private Map<String, ***KafkaTemplate> ***KafkaTemplateMap;
@PostConstruct
void load***KafkaTemplateMap() {
***KafkaTemplateMap = applicationContext.getBeansOfType(***KafkaTemplate.class);
}
... how about you think the design ? thx |
Beta Was this translation helpful? Give feedback.
-
You shouldn't use |
Beta Was this translation helpful? Give feedback.
-
@garyrussell I report one interest issue to you #2067 |
Beta Was this translation helpful? Give feedback.
-
Hi @garyrussell I found we can do it like this
} spring will auto inject related beans into this map, how about this ? |
Beta Was this translation helpful? Give feedback.
-
Problem define:
We have different Kafka clusters , one is building on AWS , one is on our internal DC.
here is our call flow diagram, Wx internal DC consume service can only connect internal DC Kafka , we want to build one routing service base on some static rule to forward message from AWS Cluster kafka to Internal DC Kafka
Example
AWS cluster Kafka send message bring Header (Key :domain, Value: domain001 )
Router service parse Header base on domain001 query DC mapping then send to target Internal DC Kafka
@garyrussell do you have any idea on this kind of case ? can we base on record header to do routing ? can spring-kafka have well support on this case?
Beta Was this translation helpful? Give feedback.
All reactions