omg run should be able to use a running container
This is very useful for testing subscriptions.
- Set up event listener
omg subscribe listen events -a eventName='heartbeat'
- Send events
omg run publish -a eventName=heartbeat -a data='{"time":"foo"}'
Currently this spawns a new docker container and there's no option to use an existing one.
Similarly, it would be helpful if omg subscribe could attach to a running container too, s.t. we can easily test multiple subscribe endpoints.
For clarification, imagine if someone specifies different env variables in both omg invocations, do we still re-use?
I think for now it's okay to error when the user specified different environment variables in the omg run publishcommand.
Bumping the priority here as there's no (easy) way without this to test OMS events. Even for our templates we had to add fake events to be able to test them:
https://github.com/microservices/node-events/blob/51f7c6b468bcd64d6c6d37722e466cf2b83663cc/src/index.js#L113-L119
Related issue: https://github.com/microservices/oms/issues/183 (no validation of received events)