问题描述
让我们考虑一个提供送货服务的零售商/餐厅连锁店:
- 每个仓库/餐厅都会发送报告不同事件的状态消息(此类消息很可能并不总是包含相同的字段),例如:
type: restaurant.status
msg_timestamp
restaurant_id
number_of_orders_last_30_min
number_of_orders_last_60_min
或
type: restaurant.status
msg_timestamp
restaurant_id
offer_of_the_day
- 客户订购与餐厅相关的某些产品:
type: order.status
msg_timestamp
product.type: product.status
product.info
order_id
order_timestamp
restaurant_id
product.type
和product.info
是另一条描述产品(价格,库存,...)的消息,但也有restaurant_id
。
或
type: order.status
msg_timestamp
completion_degree
order_id # only unique for open orders of a restaurant
order_timestamp
restaurant_id
因此order_id
,order_timestamp
和restaurant_id
唯一地定义了一个订单,但没有唯一地定义初始订单消息。
当然,可能会有更多的状态类型,例如对于客户而言,实际交货时间是
我无法更改原始消息。但是我可以在Kafka中进行某些预处理。
- Kafka中的状态消息可能没有正确的时间戳顺序,例如在发布新订单之前不久,更新的产品可能会比订单晚被摄取。
- order_timestamp与实际交付之间的时间范围可能太大,以至于无法同时依靠这两个消息。
问题:哪些图形数据库适合此类数据?如何处理邮件? 最好的情况是,边缘会由数据库本身内部的某些逻辑生成(即使消息时间戳之间的时间范围更大),例如(建议):
- 从订单到产品:使用相同的
product.status
处理所有restaurant_id
类型的消息。选择order_timestamp
之前的最新版本(因为价格或库存变化)。 - 从交付到订购:从
order.status
,restaurant_id
和order_timestamp
到所有类型为order_id
的邮件,然后选择带有product.info
字段的邮件。
由于性能影响,我担心通过更新文档将一个订单的消息合并在一起是不可行的吗?然后order_id
,order_timestamp
和restaurant_id
将为文档定义唯一的ID。
感谢您的帮助!谢谢!
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)