66using SeqCli . Cli . Features ;
77using SeqCli . Config ;
88using SeqCli . Connection ;
9+ using SeqCli . Signals ;
910using SeqCli . Util ;
1011using Serilog ;
1112
@@ -20,9 +21,10 @@ class CreateCommand : Command
2021 readonly ConnectionFeature _connection ;
2122 readonly OutputFormatFeature _output ;
2223
23- string ? _title , _appId ;
24+ string ? _title , _appId , _streamIncomingEventsSignal ;
2425 readonly Dictionary < string , string > _settings = new ( ) ;
2526 readonly List < string > _overridable = new ( ) ;
27+ bool _streamIncomingEvents ;
2628
2729 public CreateCommand ( SeqConnectionFactory connectionFactory , SeqCliConfig config )
2830 {
@@ -48,12 +50,24 @@ public CreateCommand(SeqConnectionFactory connectionFactory, SeqCliConfig config
4850 _settings . Add ( name , valueText ?? "" ) ;
4951 } ) ;
5052
53+ Options . Add (
54+ "stream:" ,
55+ "Stream incoming events to this app instance as they're ingested; optionally accepts a signal expression limiting which events should be streamed" ,
56+ s =>
57+ {
58+ _streamIncomingEvents = true ;
59+
60+ if ( ! string . IsNullOrEmpty ( s ) )
61+ {
62+ _streamIncomingEventsSignal = s ;
63+ }
64+ }
65+ ) ;
66+
5167 Options . Add (
5268 "overridable=" ,
5369 "Specify setting names that may be overridden by users when invoking the app" ,
5470 s => _overridable . Add ( s ) ) ;
55-
56- // The command doesn't yet implement "Stream incoming events".
5771
5872 _connection = Enable < ConnectionFeature > ( ) ;
5973 _output = Enable ( new OutputFormatFeature ( config . Output ) ) ;
@@ -77,6 +91,8 @@ bool ValidateSettingName(string settingName)
7791 }
7892
7993 instance . Title = _title ;
94+ instance . AcceptStreamedEvents = _streamIncomingEvents ;
95+ instance . StreamedSignalExpression = ! string . IsNullOrWhiteSpace ( _streamIncomingEventsSignal ) ? SignalExpressionParser . ParseExpression ( _streamIncomingEventsSignal ) : null ;
8096
8197 foreach ( var setting in _settings )
8298 {
0 commit comments