@@ -20,14 +20,16 @@ import devtools.lib.rxui.FxRender.DefaultFxRenderes
20
20
import devtools .lib .rxui .UiImplicits ._
21
21
import devtools .lib .rxui ._
22
22
import io .reactivex .schedulers .Schedulers
23
+ import org .apache .commons .cli .{DefaultParser , Options }
23
24
import org .apache .kafka .common .errors .InterruptException
24
25
25
26
import scala .concurrent .{ExecutionContextExecutor , Future }
26
27
import scala .language .postfixOps
27
28
28
29
class KafkaDataViewerAppPane (val layoutData : String = " " ,
29
30
connections : BehaviorSubject [Seq [ConnectionDefinition ]],
30
- filters : BehaviorSubject [Seq [FilterData ]]
31
+ filters : BehaviorSubject [Seq [FilterData ]],
32
+ defaultGroup : String
31
33
)(implicit uiRenderer : UiRenderer ) extends UiObservingComponent {
32
34
33
35
case class ConnectionsSet (logging : ConsumerConnection , read : ConsumerConnection , master : ConsumerConnection , producer : ProducerConnection )
@@ -112,7 +114,12 @@ class KafkaDataViewerAppPane(val layoutData: String = "",
112
114
override def content (): UiWidget = UiPanel (" " , Grid (), items = Seq (
113
115
UiSplitPane (" grow" , orientation = UiHoriz , proportion = 15 , els = (
114
116
UiTabPanel (tabs = Seq (
115
- UiTab (label = " Connections List" , content = new KafkaConnectionsListPane (connections = connections, onConnect = onConnect)))),
117
+ UiTab (label = " Connections List" ,
118
+ content = new KafkaConnectionsListPane (
119
+ connections = connections,
120
+ onConnect = onConnect,
121
+ defaultGroup = defaultGroup
122
+ )))),
116
123
UiTabPanelExt [ConnHandle ](
117
124
tabs = connectOps,
118
125
selection = selected,
@@ -326,17 +333,19 @@ object KafkaDataViewer {
326
333
327
334
def main (args : Array [String ]): Unit = {
328
335
329
- // val options = new Options()
330
- // options.addRequiredOption("n", "groupname", true, "Group name to connect to kafka server")
331
- //
332
- // val cli = new DefaultParser().parse(options, args)
333
- // val groupName = cli.getOptionValue("n")
336
+ val options = new Options ()
337
+ options.addOption(" n" , " groupname" , true , " Group name to connect to kafka server" )
334
338
335
- val appSettings = AppSettings .connect()
339
+ val cli = new DefaultParser ().parse(options, args)
340
+ val groupName = cli.getOptionValue(" n" )
341
+
342
+ val defaultGroup = Option (groupName).getOrElse(" local.connection" )
343
+ val appSettings = AppSettings .connect(defaultGroup = defaultGroup)
336
344
337
345
DefaultFxRenderes .runApp(root = new KafkaDataViewerAppPane (
338
346
connections = appSettings.connections,
339
- filters = appSettings.filters
347
+ filters = appSettings.filters,
348
+ defaultGroup = defaultGroup
340
349
), postAction = uiRenderer => {
341
350
implicit val ec : ExecutionContextExecutor = scala.concurrent.ExecutionContext .global
342
351
Future { AppUpdate .verify() }.onComplete(r => {
0 commit comments