事件,频道,主题有什么区别?

发布于 2025-02-11 20:09:45 字数 453 浏览 2 评论 0原文

通过参考Kafka,所有这些有什么区别?

可以说,我有一个组件“顺序”,当我创建/取消/修改订单时,必须将事件发射到kafka-channel中。

我创建了一个频道。作为“订购”。主题是我可以在此频道中使用的名称吗? 什么是主题与频道?

这是订单范围的组件。创建&维护所有此类命令的记录。 我想在此组件的订阅者部分中使用一个orderevents类。

public class OrderEvents {
  public static final String ORDER_CREATED = "ORDER_CREATED";
  public static final String ORDER_MODIFIED = "ORDER_MODIFIED";
  public static final String ORDER_CANCELLED = "ORDER_CANCELLED";
}

With refernce to Kafka, what is the difference between all these?

Lets say I have a component "Order" which must emit events into a kafka-channel when I create/cancel/modify orders.

And I create a channel. As "Order-out". Is topic the name I can use for this channel?
What is topic vs channel?

And this is the Order-Details component. Which creates & maintains records of all such orders.
I want to use an orderEvents class inside subscriber section of this component.

public class OrderEvents {
  public static final String ORDER_CREATED = "ORDER_CREATED";
  public static final String ORDER_MODIFIED = "ORDER_MODIFIED";
  public static final String ORDER_CANCELLED = "ORDER_CANCELLED";
}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

£冰雨忧蓝° 2025-02-18 20:09:45

事件是单一记录。在春季,您可能会使用消息类来包装事件。

频道为 spring Integration> spring Integration> spring Integration 通过Spring-kafka或输入和输出的粘合剂。活页夹确定频道的实现。

主题是组织的Kafka单位。


事件将被序列化为字节,并通过频道发送到KAFKA主题。

Kafka记录将从Kafka主题中通过频道消耗,并将其划分为应用程序事件类。

An event is a single record. In Spring, you might work with a Message class to wrap an event.

Channel is a Spring Integration term used via Spring-Kafka or Spring Cloud Stream Binders for inputs and outputs. A Binder determines the implementation of the Channel.

Topic is a Kafka unit of organization.


An event will be serialized into bytes, and sent via a channel to a Kafka topic.

A Kafka record will be consumed from a Kafka topic, through a channel, and deserialized into an application event class.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文