定义
兼容性
语法
sp.listStreamProcessors() 方法使用的语法如下:
sp.listStreamProcessors(   {    <filter>   } ) 
命令字段
sp.listStreamProcessors() 采用这些字段:
字段  | 类型  | 必要性  | 说明  | 
|---|---|---|---|
  | 文档  | Optional  | 指定按哪些字段筛选流处理器的文档。 如果提供筛选器,则该命令将仅返回与您指定的所有字段的值匹配的处理器。  | 
行为
sp.listStreamProcessors() 返回描述当前流处理工作区上所有已命名流处理器的文档到 STDOUT。
访问控制
运行sp.listStreamProcessors()的用户必须具有atlasAdmin角色。
例子
以下示例显示了在不使用任何筛选器的情况下调用该命令时sp.listStreamProcessors()的预期响应:
sp.listStreamProcessors() 
1 { 2   id: '0135', 3   name: "proc01", 4   last_modified: ISODate("2023-03-20T20:15:54.601Z"), 5   state: "RUNNING", 6   error_msg: '', 7   pipeline: [ 8     { 9       $source: { 10         connectionName: "myKafka", 11         topic: "stuff" 12       } 13     }, 14     { 15       $match: { 16         temperature: 46 17       } 18     }, 19     { 20       $emit: { 21         connectionName: "mySink", 22         topic: "output", 23       } 24     } 25   ], 26   lastStateChange: ISODate("2023-03-20T20:15:59.442Z") 27 }, 28 { 29   id: '0218', 30   name: "proc02", 31   last_modified: ISODate("2023-03-21T20:17:33.601Z"), 32   state: "STOPPED", 33   error_msg: '', 34   pipeline: [ 35     { 36       $source: { 37         connectionName: "myKafka", 38         topic: "things" 39       } 40     }, 41     { 42       $match: { 43         temperature: 41 44       } 45     }, 46     { 47       $emit: { 48         connectionName: "mySink", 49         topic: "results", 50       } 51     } 52   ], 53   lastStateChange: ISODate("2023-03-21T20:18:26.139Z") 54 } 
以下示例显示了如果您仅对state为running的流处理器调用sp.listStreamProcessors()筛选的预期响应。
sp.listStreamProcessors({"state": "running"}) 
1 { 2   id: '0135', 3   name: "proc01", 4   last_modified: ISODate("2023-03-20T20:15:54.601Z"), 5   state: "RUNNING", 6   error_msg: '', 7   pipeline: [ 8     { 9       $source: { 10         connectionName: "myKafka", 11         topic: "stuff" 12       } 13     }, 14     { 15       $match: { 16         temperature: 46 17       } 18     }, 19     { 20       $emit: { 21         connectionName: "mySink", 22         topic: "output", 23       } 24     } 25   ], 26   lastStateChange: ISODate("2023-03-20T20:15:59.442Z") 27 }