我正在阅读许多包含对象混合的文件。我有一个root流,可以流式传输对象,例如:
// root stream
{"action": "action_type_a", "id": "1234"}
{"action": "action_type_b", id: "24566"}
{"action": "action_type_b", id: "0808098"}
{"action": "action_type_b", id: "8098098"}
{"action": "action_type_a", "id": "098098"}
{"action": "action_type_b", id: "08098"}
我将流通过管道root传输到 2 个单独的grep过滤流中,其中一个过滤action_type_a我们将调用A它,看起来像:
// stream A
{"action": "action_type_a", "id": "1234"}
{"action": "action_type_a", "id": "098098"}
一个过滤action_type_b B看起来像:
// stream B
{"action": "action_type_b", id: "24566"}
{"action": "action_type_b", id: "0808098"}
{"action": "action_type_b", id: "8098098"}
{"action": "action_type_b", id: "08098"}
我也有一个单独map的 id
// id map
{
"1234" : "098098",
""098098" : "8098098"
}
所以对象上的 id 可以与对象A上的 id 匹配B
我想处理流A比较每个对象的 id 到地图,然后处理B看流中是否有相应的对象B
B在处理A.
我的第一个想法是B为A. 那可能吗?
我目前的尝试是在我试图读取和比较它的event-streams es.map流和映射函数内部使用我读过的我也写回记录到. 然而,这给了我:ABABB
(node) warning: possible EventEmitter memory leak detected. 11 listeners added. Use emitter.setMaxListeners() to increase limit.
错误,因为我B在地图中重新定义了侦听器A