1

Event Store で次のプロジェクションを作成しました。

fromCategory('Ping')
.foreachStream()
.when({
   $init: function() { 
     return { 
       min: 0,
       max: 0,
       sum: 0,
       cnt: 0
    }; 
   },
   $any: function(s, e) {
      if (s.max < e.body.AcPower) {
        s.max = e.body.AcPower;
      }
      if (s.min > e.body.AcPower) {
        s.min = e.body.AcPower;
      }
      s.sum += e.body.AcPower;
      s.cnt += 1;
      s.avg = s.sum/s.cnt;
   }
});

特定のストリームの結果を取得するにはどうすればよいですか? ストリーム ID は次のとおりです。「Ping-255.1」、「Ping-255.2」....「Ping-255.1000」

見て: http://localhost:2113/projection/stats-cont 私は得る:

{
  "coreProcessingTime": 4072,
  "version": 0,
  "epoch": -1,
  "effectiveName": "stats-cont",
  "writesInProgress": 0,
  "readsInProgress": 0,
  "partitionsCached": 1000,
  "status": "Running",
  "stateReason": "",
  "name": "stats-cont",
  "mode": "Continuous",
  "position": "$ce-Ping: 132233",
  "progress": 100.0,
  "lastCheckpoint": "$ce-Ping: 131999",
  "eventsProcessedAfterRestart": 132234,
  "statusUrl": "http://localhost:2113/projection/stats-cont",
  "stateUrl": "http://localhost:2113/projection/stats-cont/state",
  "resultUrl": "http://localhost:2113/projection/stats-cont/result",
  "queryUrl": "http://localhost:2113/projection/stats-cont/query%3Fconfig=yes",
  "enableCommandUrl": "http://localhost:2113/projection/stats-cont/command/enable",
  "disableCommandUrl": "http://localhost:2113/projection/stats-cont/command/disable",
  "checkpointStatus": "",
  "bufferedEvents": 0,
  "writePendingEventsBeforeCheckpoint": 0,
  "writePendingEventsAfterCheckpoint": 0
}

以下は機能していません: http://localhost:2113/projection/stats-cont/state?partition=255.1

前もって感謝します。

4

2 に答える 2

2

Event-store をデバッグして答えを見つけました :-)。

パーティションには実際にはカテゴリ ("Ping-255.1") が含まれているため、状態の投影状態を取得するための実際の URL は次のとおりです: http://localhost:2113/projection/stats-cont/state?partition=Ping-255.1

于 2015-04-22T15:46:00.840 に答える
0

イベント ストア 4.0 以降では、組み込みのカテゴリ別プロジェクションを有効にします。

curl "http://localhost:2113/projection/$by_category/command/enable" -X POST -H "Content-Length: 0" -H "Authorization: Basic YWRtaW46Y2hhbmdlaXQ="

この例の Authorization ヘッダーには、デフォルトの admin:changeit 資格情報が含まれています。

カテゴリ別プロジェクションが有効な場合、Ping-* イベント用に $ce-Ping ストリームが作成されます。次の URL を使用して $ce-Ping ストリームを表示します。

http://127.0.0.1:2113/web/index.html#/streams/ $ce-Ping

于 2017-11-28T15:56:33.013 に答える