英文:
Spring Cloud Contract & Test Container
问题
我正在使用Spring Cloud Contract,现在我正在为事件驱动微服务创建集成测试。
我可以将Spring Cloud Contract(消息传递)与在TestContainer上运行的Kafka容器结合使用吗?我当然想要使用StubTrigger,但它也应该从我的Kafka主题中获取消息。有什么建议吗?这是否有意义?我认为我正在混合概念。
英文:
I am using Spring Cloud Contract, now I am making an integration test for event driven microservices.
Can i combine both Spring Cloud Contract (messaging) with Kafka container running on TestContainer? I want to use the StubTrigger of course but it should fetch the message also from my Kafka topic. Any suggestion? Does it even make sense? I think i am mixing the concepts.
答案1
得分: 3
你可以。你可以在这里查看有关Kafka和testcontainers的示例:https://github.com/spring-cloud-samples/spring-cloud-contract-samples/tree/main/consumer_kafka_middleware 和 https://github.com/spring-cloud-samples/spring-cloud-contract-samples/tree/main/producer_kafka_middleware。
英文:
Yes you can. You can check out the examples with kafka and testcontainers here https://github.com/spring-cloud-samples/spring-cloud-contract-samples/tree/main/consumer_kafka_middleware and here https://github.com/spring-cloud-samples/spring-cloud-contract-samples/tree/main/producer_kafka_middleware
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论