photon icon indicating copy to clipboard operation
photon copied to clipboard

Allow event to exist on more than 1 stream and be persisted once

Open daviddawson opened this issue 7 years ago • 0 comments

I have multiple cases where an event is emitted to more than 1 stream. This can happen at the same time, where an event goes onto 2 streams in a single operation. It can also happen async, where an operation on a seen event means that the event is re-emitted to a different stream.

It would be useful to be able to emit an event onto more than one stream, and to re-emit an event by id and have it persisted once, but be given different order-ids on each stream that it exists on.

I'd like to do this to emit an event onto more than one stream

var newEvent = {
  "event-type": "SomethingHappened", "stream-name": ["stream1", "stream2"],
  "payload": {"message": "hello world"}
}
muon.emit(newEvent);

and re-emitting an existing event

var event = ... some existing event...
var newEvent = {
  "stream-name": "new-stream"
  "existing-order-id": event["order-id"]
}
muon.emit(newEvent);

In both cases, the event should be given a seperate order-id on each stream it exists on, but should be persisted only once.

daviddawson avatar Apr 26 '17 10:04 daviddawson