-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added AccountEventProducer to publish events on Kafka
- Loading branch information
Showing
3 changed files
with
32 additions
and
3 deletions.
There are no files selected for viewing
19 changes: 19 additions & 0 deletions
19
...-acct/acct.cmd/src/main/java/co/marcuss/acct/cmd/infrastructure/AccountEventProducer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package co.marcuss.acct.cmd.infrastructure; | ||
|
||
import co.marcuss.cqrs.core.events.BaseEvent; | ||
import co.marcuss.cqrs.core.producers.EventProducer; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.kafka.core.KafkaTemplate; | ||
import org.springframework.stereotype.Service; | ||
|
||
@Service | ||
public class AccountEventProducer implements EventProducer { | ||
|
||
@Autowired | ||
private KafkaTemplate<String, Object> kafkaTemplate; | ||
|
||
@Override | ||
public void produce(String topic, BaseEvent event) { | ||
this.kafkaTemplate.send(topic, event); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
cqrs-es/cqrs.core/src/main/java/co/marcuss/cqrs/core/producers/EventProducer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package co.marcuss.cqrs.core.producers; | ||
|
||
import co.marcuss.cqrs.core.events.BaseEvent; | ||
|
||
public interface EventProducer { | ||
|
||
void produce(String topic, BaseEvent event); | ||
} |